How Often a component spent in a specific time of day over period of days

Trying to explain what I’m after:

I have data from Prometheus over few days (let’s say on off state of light switch), I want a panel to show me over the course of a week / a month - how often the switch was on at a given time of day?

Say over the past month, switch was on 67% of the time and off 33% at 19:30

I would love to visualize state of the sensor through out the day over a period of time like that…

Are there a query and a panel that would allow me to Do This?
Examples appreciated :wink:

Hi,

Have a look at the Discrete panel plugin.

In general, you may be able to use the count() aggregation in prometheus to be able to do count number of times switch was on / total times switch was on/off = percentage of switch was on.

Marcus