[rrd-users] PREV(x) 1.0.39

Darren Kelly darren.kelly at shenick.com
Tue Oct 1 15:31:29 MEST 2002

Hi All,

While we're on the "PREV(x)" subject, I have a concern about whether it
works the way it should (or might be expected to).
Run the following three commands and consider the graph generated:

rrdtool create /tmp/dpk.rrd -s 1000 -b 1000000000 \
                            DS:ds:GAUGE:2000:U:U  \
rrdtool update /tmp/dpk.rrd 1000003000:2 \
                            1000004000:4 \
                            1000005000:6 \
                            1000006000:8 \
rrdtool graph /tmp/dpk.gif -s 1000002000 -e 1000010000 \
              DEF:x=dpk.rrd:ds:LAST LINE3:x#000000:TEST \
              "CDEF:y=PREV(x)"      LINE3:y#0000ff:Prev \
              CDEF:z=x,y,-          LINE2:z#ff0000:Diff \
              -h 400 -w 600

The black line shows the values recorded by the update command 2, 4, 6, 8,
The blue line should show the previous value of x, I'd expect to see this
line trail the black one by one period.
And the red line should show delta x. Looking at the values in the update
command we would expect the deltas to be steady at 2 for three periods and
then to drop to -8 for one period.
However, the blue line trails the black line by two periods as opposed to
one. This causes the red line to give the difference between the current and
the previous-but-one value. So the red line is at 4 for one period and then
drops to -6.

Does anyone have an explanation for the discrepancy between what I got and
what I expected?

Thanks in advance,

Darren Kelly
Shenick Software Systems
1-2 Windsor Terrace                              Opening Windows of
Dun Laoghaire                                       Opportunity
Co. Dublin
Ireland							Tel:+ 353 1 236 7002

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-users mailing list