Grafana - Display Gen Set Runtime

Hi Everyone -

Not sure how to create this query in Influxdb so hopefully someone can help me out:

I have attached 3 CTs to our gen set at the office and I would like to build a new Panel which simply displays the total time the generator has run. I would assume the best way is to create a query which adds the time for any value of “total_gen_power” which is > 0 and adds that time to says “total_gen_run_time”.

Any help on this would be highly appreciated. Thank you everyone!



Taking a quick look at the influx functions documentation, you may want to try using the count() function to count the number of non-zero power values in each group, multiplying that total by the measurement interval in seconds should produce the total seconds runtime for each group. That can be converted to minutes, hours etc using the obvious math.

Thank you so much, let me try this out. Apparently its an interesting issue among other IoT users: