[rrd-users] How to graph slow changing counters

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Mar 30 16:56:48 CEST 2020


Thorsten Erdmann schreef op 2020-03-30 15:34:

> you are right (and I know) that with such a low resolution it is
> difficult to draw sensefull data. But I want to understand what RRD
> does. I think the aggregation is wrong:
> 
> If I sample the data every 5 minutes (1/12h) and get a single 1kWh
> step in one of these 5 minute intervals then I get a peak about 0,3kW
> in the dayly graph. But why? I get headache with these calculation. I
> would say the formular is 1kWh / (1/12)h but that gives 12kW, which is
> definitely wrong.

You feed 'something' to RRDtool and it will process it into 'something 
per second'. That's how it works if you feed COUNTER values.

If you get an ever increasing value, as is usually the case from 
electricity meters, then COUNTER is indeed the type to use. GAUGE may 
provide a pretty (prettier) picture, but it is wrong. Gauge is when you 
already have 'something per second'.

Make sure you understand kWh. It is >>>not<<< kilowatt _per_ hour. It is 
a kilowatt _during_ an hour. In other words, it is 1000 Joule per 
second, during 3600 seconds, thus 3,6 MJ.  If you multiply by 3600000 
during graph time (use a CDEF) then you will display J/s aka W.

If you have one 5-minute slot filled with 1 kWh, it is 1/300 kWh/s so I 
expect to see a number close to 0,003333333... or 3m3333.... It may be a 
bit different due to normalization. You also get a lot of slots with 0 
or near 0. Over time this should average out. 12 slots, one having a 
rate of 0,003333... and the rest 0, would average out to a rate of 
0,00027777... valid during an hour. Yes, this is smaller, but that is to 
be expected. After all, you did not use a kWh during 5 minutes, you did 
it during an hour (or even longer amount of time). Dividing that same 
kWh by 1 or even 2 hours does correctly result in a smaller average 
rate.

If RRDtool is doing its job properly, and if your estimate of one 1 kWh 
every few hours is correct, then you would end up with a few kWh a day, 
still not many a week. You would get weird combinations such as 
"mkWh/s". Sounds wrong, but it is, in a way, correct.  Again: multiply 
by 3,6M to get J/s, or Watt. Perhaps this makes more sense.

You start with 'weird jumps' because you have 1 interval filled with a 
huge rate and then many intervals with zero rate. Over time this should 
average out.

Example:

{1/300 0 0 0 0 0 0 0 0 0 0 0} could average out to 1/3600. The next 
consolidated interval may look lke this:
{1/300 0 0 0 0 0 0 0 0 0 0 1/300} and averaged out it is 2/3600. Weird 
peak? Not really, it makes sense.

Your real world will of course look much more complex than this 
simplified example.

In the month graph, looking at days at a time, I expect to see less 
jumping around. If not, try another version of RRDtool.

HTH
Alex



More information about the rrd-users mailing list