Adapting UPS Load as a % from Prometheus to kWh in Grafana

  • What Grafana version and what operating system are you using?
    Grafana v10.0.2 (b2bbe10fbc)
    Latest grafana docker image

  • What are you trying to achieve?
    Hourly, Daily, Weekly and Monthly kWh power consumption and cost (based off local power rates as a variable) shown as bar graphs using Prometheus and Grafana.

  • How are you trying to achieve it?
    By using NetworkUpsTools aka “nut” (github) and nut-exporter (github) to actively poll my three UPS’s for metrics. Then, aggregate that information for power monitoring on Grafana.

  • What happened?
    I am only able to extract total load as a percentage for each of the UPS’s. However, I am able to determine VA, PF, and maximum rated wattage output from data sheets. Despite this, I wasn’t able to use queries, expressions or transformations to achieve the desired results.

  • What did you expect to happen?
    Using this information I should be able to roughly extrapolate the current wattage being used, average the per-minute values, and calculate the kWh for each UPS. Then, I wanted to show this data in incrementally larger time frames, as stated previously.

  • Can you copy/paste the configuration(s) that you are having problems with?
    I had a broken mess of a graph with 9 different transformations that I was working with, but lost it with an inadvertent page refresh.
    I can however supply the simple queries I’m working with and their output:

Query A:


Query B:


Query C:


The output is an integer between 0 and 100 indicating the percentage load.
Note that in my attempts to aggregate any number of samples into 1 minute averages has turned up rare occurrences of null values, so that was an additional issue I couldn’t seem to overcome.
Tripplites = SMART1000RM1U
Cyberpower = CP1500PFCLCD

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?
    Not really, I searched a bunch of sources on how to calculate kWh, downloaded several grafana community dashboards to try and adapt them to my purpose, and read multiple grafana community forum posts, but most of the information is for either InfluxDB, InfluxDBv2 or SNMP/IPMI, so I didn’t make much progress.

I hope someone can help me with this, I would greatly appreciate any and all assistance.