[rrd-users] How to graph slow changing counters

Simon Hobson linux at thehobsons.co.uk
Mon Mar 30 14:08:42 CEST 2020

Thorsten Erdmann <thorsten at trektech.de> wrote:

> I want to graph the data of my energy meter. But it is measuring only in 1kWh raster. So with normal power usage I have every 2..4 hours a step of 1kWh. The meter displays it’s data as kWh, so it gives e.g 600 for the absolute counter value of 600kWh.
> I sample the absolute energy every 5 minutes. So I took this as step and 600s as heartbeat.
> What I get is short peaks with a height which is displayed as 330u over a period of 24h. With longer periods like a week the values get smaller and smaller and there are weird stepping curves. So how can I measure/graph such low resolution measures in a senseful way?

Realistically, there's not a lot you can do with such low resolution data. You'll get a spike each time a unit clocks up, then as you zoom out for a longer scale view, it will flatten out to (as you've found) a rather low value. If you are using a unit every (say) 3 hours (taking a mean between your 2 and 4 hours), then that equates to an average of 333W - or if you are just storing kWH, 0.333kW. Again depending on how you store and calculate, this then equates to around 93µJ/s - at least, if my brain is working right this afternoon !

You don't say how you are interrogating the meter - is it via a data source it provides ?
If the meter is providing you with a counter value when asked, then this will give you the best long term accuracy - your counter will always match what is in the meter.

As an alternative, many meters provide a pulsed output of some sort (even if it's only an LED flashing). A bit like the old Ferraris disk meters with their "X revolutions/kWH", the meter pulses will give you an indication when a much lower quantity of energy has been used - it should say on the face of the meter how many pulses/kWH. The downside to counting these pulses is that if your counter isn't running or otherwise misses them, then you lose sight of energy consumed and your RRD calculations will show a lower figure than the meter.

You could, of course, collect both sources - use the pulses for short term indication (ie better graphing up to a few days duration) and the register count for longer term.

More information about the rrd-users mailing list