I have this Prometheus query that i am using to calculate the power consumption of apc PDUs in KWH,
sum(sum_over_time((rPDU2DeviceStatusPower_gauge{site=~"$site"})[$__range] /100 ) / count_over_time(rPDU2DeviceStatusPower_gauge{site=~"$site"}[$__range]) * ($__range/3600)) by (site)
i am visualizing this in pie chart that why i am grouping by site name of each pdu.
my collect interval is 5min
the metric rPDU2DeviceStatusPower_gauge return the power consumption of the pdu load in hundredths of kilowatts, that's why i am dividing by 100
can you tell me if this query is correct ?
What i tried : the query above
What i am expecting : well, to get the correct value in kwh
can be boiled down to
avg_over_time(rPDU2DeviceStatusPower_gauge{site=~"$site"}[$__range])/100.So, your resulting query would be:
If
rPDU2DeviceStatusPower_gaugereports reports in hundreds of kW, then result should be estimation of power consumption in kWh.Also, if
rPDU2DeviceStatusPower_gaugeis generated by your side, consider Best practices regarding naming and units of your metrics. If it possible at least move from hundreds kW to kW.