Show power consumption for the current day in Grafana / Prometheus

Viewed 317

I've got a smart meter (Dutch Smart Meter, DSMR) hooked up to a prometheus exporter, exporting metrics (among others) shown below. I want to set up bar graphs that shows the power consumption per day for the e.g. last week or so and I want to compute the power consumed on the current day. That means that I want to show the power consumed between 0:00 and 23:59 each day.

# HELP p1_meter_reading_tariff_1 meter reading power delivered to client in kWh at tariff 1
# TYPE p1_meter_reading_tariff_1 gauge
p1_meter_reading_tariff_1 4117.739
# HELP p1_meter_reading_tariff_2 meter reading power delivered to client in kWh at tariff 2
# TYPE p1_meter_reading_tariff_2 gauge
p1_meter_reading_tariff_2 3704.243

These values are in principle always strictly increasing. If different data types would be better, I can change them.

I've tried some variants of increasing(metric[24h]) but the problem with these is that they show (some variant of) the "last x hours" instead of the current day, which is not what I want. This is also the problem with related questions on SO: they invariably don't answer the "reset the count at 0:00 in the morning" part of this question.

It might also be solvable in Grafana rather than Prometheus, and that would also be acceptable.

0 Answers
Related