[rrd-users] How to get MAX/MIN of non-rates?

Simon Hobson linux at thehobsons.co.uk
Wed Apr 3 20:52:07 CEST 2013

Tony Mountifield wrote:
>This has shown up another issue which is related to the "everything is a rate"
>philosophy of RRD. I am using a RRD GAUGE DS to log values which are not rates,
>but rather instantaneous values (e.g. disk space, channel usage, temperature).
>Let's say I log a value of 20 at time x. The input data changes to 25 at time
>y, so I log it at that time. I want the graph to show 20 from time x to time y
>and 25 from time y onwards.
>However, RRD is taking those values to be pre-derived *rates since the
>previous update*. So it is assuming the 25 means the average rate of
>something between time x and time y. So the graph is always one update
>adrift of the true change in values.

No, how can you be sure that the rate didn't change a microsecond after you read it ?

>The only way around this that I can think of is to remember the old value,
>and write it to the immediately preceding time. So in the above example,
>at time y I would write the old value of 20 to time y-1 and then the new
>value of 25 to time y.


>Is there any way, in that version or a newer version, to properly handle
>values that are instantaneous quantities rather than rates, without having
>to resort to the dual-write kludge I mentioned above?

The way it's doing it now is not incorrect, just not what you want. If you sample at t=0 and t=10, then you only know the values at t=0 and t=10 - you don't know the values at t=1, t=2, ... t=9. At t=10, you only know (when using RRD for it's primary task) that the *AVERAGE* between t=0 and t=10 was <something>. RRD correctly shows the value stored at t=10 as applying between t=0 and t=10, not as predicting the future between t=10 and t=20.
Gauge values don't change that, they are really just a fudge to store numbers in place of rates.

Short answer - no, RRD won't do what you want.

More information about the rrd-users mailing list