[rrd-users] Can't understand rrd way of storing data

Simon Hobson linux at thehobsons.co.uk
Tue Aug 5 12:15:20 CEST 2008

Benoit Giannangeli wrote:

>I've just discovered rrd and it seems to be the perfect tool for
>collecting statistical data. Anyway I don't really get how rrd does to
>collect data.
>I just want to get exact values at exact times.
>Here is an example:
>rrdtool create test.rrd --start 1217401440 --step 20
>                         DS:messages:GAUGE:40:U:U
>			DS:processed:GAUGE:40:U:U
>			DS:msize:GAUGE:40:U:U
>			RRA:AVERAGE:0.99:1:6
>rrdtool update test.rrd 1217401462:5.0:U:U
>rrdtool update test.rrd 1217401463:5.0:U:U
>rrdtool update test.rrd 1217401470:7.0:U:U
>rrdtool update test.rrd 1217401471:3.0:U:U
>rrdtool update test.rrd 1217401490:1.0:1.0:4181320.0  # Got 4181320.0
>at time 1217401490 so why is it stored at 1217401480 ?
>rrdtool update test.rrd 1217401496:2.0:U:U
>rrdtool update test.rrd 1217401497:8.0:U:U
>rrdtool update test.rrd 1217401535:1.0:1.0:1.3855684E7
>rrdtool update test.rrd 1217401548:1.0:1.0:4181310.0
>rrdtool update test.rrd 1217401560:1.0:1.0:1457203.0
>rrdtool update test.rrd 1217401562:4.0:U:U
>rrdtool update test.rrd 1217401563:6.0:U:U
>rrdtool fetch test.rrd AVERAGE --start 1217401420 --end 1217401560
>1217401440:  NaN  NaN  NaN
>1217401460:  +5.0000000000E00  NaN  NaN	  # I got nothing within
>1217401440 and 1217401460, so why 5 is stored ?
>1217401480:  +3.8000000000E00  +1.0000000000E00  +4.1813200000E06
>1217401500:  +1.3250000000E00  +1.0000000000E00  +1.0924058545E07
>1217401520:  +1.3250000000E00  +1.0000000000E00  +1.0924058545E07
>1217401540:  +1.0000000000E00  +1.0000000000E00  +1.1437090500E07
>1217401560:  +1.0000000000E00  +1.0000000000E00  +2.5468458000E06
>1217401580:  NaN  NaN  NaN
>I don't understand why I get values such as 1.3 for messages or
>2.54E06 for msize...
>Anyway, why is it so hard to store value as they are ?

Because the tool is NOT designed to do what you are asking for.

See Alex's tutorials, in particular on normalisation, at 

RRDtool stored values ONLY at exact multiple of the step size. When 
you feed it values at any other time then it will normalise the data 
to fit the predefined storage bins. You can get it to return exactly 
the values entered by storing values only on exact multiples of the 
step period (datum is at Unix eopch, midnight, Jan1 1970).

Also, note that RRDtool only stores rates. You can fudge things to 
make it look like it's storing values, but it actually only stores 

More information about the rrd-users mailing list