Help with Sum of hourly average

124 views
Skip to first unread message

Malek Balek

unread,
Dec 5, 2023, 5:48:49 AM12/5/23
to Prometheus Users
Hello all,
I'm a little stuck with this one as i don't understand how to do it with and maybe you could help me with this one.

I scrap an APC every 5 min to get the instant power consumption

And i would like to calculate the average consomption of every hour and then sum up this average to get the daily consomption in grafana.

Something like this:



i've tried
(sum_over_time((avg_over_time({metric="Consomation", __name__="snmp_value"}[1h]))[24h]))

But the data seem wrong, and grafana is showing data per hour

Do you know the correct way to do it ?

Malek

Ben Kochie

unread,
Dec 5, 2023, 5:54:03 AM12/5/23
to Malek Balek, Prometheus Users
Without knowing the units, it's hard to answer what exactly you're trying to get. The value is an instantaneous watts and you want watt-hours?

avg_over_time(snmp_value{metric="Consomation"}[24h]) * 24

This will give you the watt-hours over the 24 hours.



--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/39a2ef03-df25-47aa-916a-6d4a435efb21n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages