[rrd-users] Displaying "difference" or "Change" over the displayed period

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Thu Mar 8 03:19:51 CET 2012

> Hi,
>      I have been using RRD for quite a while now, and I would like to
> replicate something that my old weather station gave.
>      That is, how much rain has fallen over the previous 24Hrs (though
> the weather station previous 24Hr reset at midnight) I'm sure RRD would
be able to do the full 24Hr, or full time scale -24H or -48H...

RRDtool is based on UTC time internally. Look through the archives if you
are not aware of this.

>          But I cannot work out how to get it to display (MAX-MIN) to =
> 4.03
> code:
> DEF:rain-max=rain.rrd:R24h:MAX \
> DEF:rain-min=rain.rrd:R24h:MIN \
>    VDEF:MaxRn=rain-max,MAXIMUM \
>    VDEF:MinRn=rain-min,MINIMUM \
>    CDEF:R24Hr=rain-max,rain-min,- \ <- This doesn't work

I think it does work, but does not do what you want it to do?
Maybe you also tried:

This CDEF is not supposed to work, it would be nice if this VDEF would
work, but nobody programmed this yet.

Try this hack, you may need to tweak it a bit:


Unless one of the variables involved is an unknown or infinite, this
should result in one straight line at (MaxRn-MinRn).

I start with one of the available DEFs (a CDEF would also do).
Then I add MaxRn minus MinRn.
Then I remove the DEF again.

Why add and remove the DEF? Because a CDEF needs to now how many buckets
and how much time per bucket. This property comes from the DEF and stays,
even after removing the values from the DEF.


More information about the rrd-users mailing list