[rrd-users] problem understanding update

marie marie.durand at eservglobal.com
Thu Nov 29 17:20:53 CET 2007


Hi all,

I have trouble understanding the update function behaviour, mainly with
the 'N' feature.

Assume you have created the following rrd database:

--
rrdtool create test_mechanism.rrd --start `date +%s` --step 1 \
    DS:number:GAUGE:2:U:U RRA:LAST:0.5:1:20 ;
--

I try to update this small rrd by adding values (from 10 to 90 ) every
second during 10 seconds with the following little bash script (which is
not a very clean one!):

--
#!/bin/sh
    
i=1
while [ $i -lt 11 ]
do
    current=`date +%s`
    value=`expr $i \* 10`
#    echo $value at $current
    rrdtool update test_mechanism.rrd N:$value
    i=`expr $i \+ 1`
    perl -e 'sleep 1 - time % 1'
done
--

then I look at the values with:

--
rrdtool fetch test_mechanism.rrd --end `date +%s` --start end-20s LAST
--

When I work with the 'N:' (to set the update time to the current time),
I get the following:

--
		number

1196351121: nan
1196351122: nan
1196351123: nan
1196351124: nan
1196351125: nan
1196351126: nan
1196351127: nan
1196351128: nan
1196351129: 6.8761200000e+00
1196351130: 2.3164400000e+01
1196351131: 3.2926020000e+01
1196351132: 4.2685900000e+01
1196351133: 5.2485790000e+01
1196351134: 6.2322260000e+01
1196351135: 7.2100670000e+01
1196351136: 8.1891870000e+01
1196351137: 9.1694170000e+01
1196351138: nan
1196351139: nan
1196351140: nan
1196351141: nan
--

while when I work giving the actual timestamp 
(the "rrdtool update" line now becomes :
	rrdtool update test_mechanism.rrd $current:$value
)
I get the following:

--
		number

1196352521: nan
1196352522: nan
1196352523: nan
1196352524: nan
1196352525: nan
1196352526: nan
1196352527: nan
1196352528: nan
1196352529: 2.0000000000e+01
1196352530: 3.0000000000e+01
1196352531: 4.0000000000e+01
1196352532: 5.0000000000e+01
1196352533: 6.0000000000e+01
1196352534: 7.0000000000e+01
1196352535: 8.0000000000e+01
1196352536: 9.0000000000e+01
1196352537: 1.0000000000e+02
1196352538: nan
1196352539: nan
1196352540: nan
1196352541: nan
--

which is closer to what I expect.

Why is there such a difference in the values inserted by the two update
ways ? (2.0000000000e+01 vs 6.8761200000e+00, for example)
What am I misunderstanding ?

Thank you all,

Marie Durand



More information about the rrd-users mailing list