# [rrd-users] Fw: extrapolation function

Calum Anderstrem canderstrem at pacificwireless.com.au
Wed Feb 19 08:38:04 MET 2003

```Hi,

I am new to RRDTool and have been familiarising myself with it by trying out various examples. One of the things I am interested in is how the extrapolation function works in calculating the PDP's, and to this end I created a very simple RRD with one DS and a step of 10 seconds as shown below:

C:\RRDTool>rrdtool create test -b 920804400 -s 10 DS:speed:GAUGE:120:U:U RRA:AVERAGE:0.5:1:10

The assumption I was trying to confirm was that the extrapolation function worked by drawing a line between the two points on either side of the sample period, and calculating from that what the value would be at the correct time. I knew the first sample would be at 920804410, so I place values 5s on either side of this with values of 0 and 1 as shown:

C:\RRDTool>rrdtool update test 920804405:0  920804415:1

And got the result I was expecting of 0.5:

C:\RRDTool>rrdtool fetch test AVERAGE -s 920804400 -e 920804430
speed

920804400: -1.#IND000000e+000
920804410: 5.0000000000e-001
920804420: -1.#IND000000e+000
920804430: -1.#IND000000e+000

I then redid the test with the values of 0 and 1 at times 1 and 11 seconds:

C:\RRDTool>rrdtool create test -b 920804400 -s 10 DS:speed:GAUGE:120:U:U RRA:AVERAGE:0.5:1:10

C:\RRDTool>rrdtool update test 920804401:0  920804411:1

And again got the expected result of 0.9:

C:\RRDTool>rrdtool fetch test AVERAGE -s 920804400 -e 920804430
speed

920804400: -1.#IND000000e+000
920804410: 9.0000000000e-001
920804420: -1.#IND000000e+000
920804430: -1.#IND000000e+000

This time I created the same RRD (different start time), and again entered two values, 0 at 5 seconds and 100 at 10 seconds. Since the second sample fell on the exact time of the sample I was expecting the result to be 100, however as can be seen below it returned the average of the two values which is 50.

C:\RRDTool>rrdtool create test -b 900000000 -s 10 DS:speed:GAUGE:20:U:U RRA:MAX:0.5:1:10

C:\RRDTool>rrdtool update test 900000005:0 900000010:100

C:\RRDTool>rrdtool fetch test MAX -s 900000000 -e 900000010
speed

900000000: -1.#IND000000e+000
900000010: 5.0000000000e+001

I redid the test, this time passing 3 values that increase by 100 every 10 seconds. The first and last values were given the exact sample time of 10 and 30 seconds respectively, but the second was made to arrive early at 17 seconds (value of 170).

C:\RRDTool>rrdtool create test -b 900000000 -s 10 DS:speed:GAUGE:20:U:U RRA:MAX:0.5:1:10

C:\RRDTool>rrdtool update test  900000010:100
C:\RRDTool>rrdtool update test  900000017:170 900000030:300

I was looking for the first and third sample to be the same as inputted, but the second to be adjusted to 200, however the following was received:

C:\RRDTool>rrdtool fetch test MAX -s 900000000 -e 900000030
speed

900000000: -1.#IND000000e+000
900000010: 1.0000000000e+002
900000020: 2.5450000000e+002
900000030: 2.5450000000e+002

This is the windows version of RRDtool, just in case that is an issue.
I would be grateful for any assistance with either explaining the above or pointing out where I've gone wrong.