[rrd-users] Calculation of average

Tobias Oetiker tobi at oetiker.ch
Tue Jun 26 08:19:36 CEST 2012

```Yesterday rp2 wrote:

>
> I have the  created the following rrd and on filling in value I get the
> following output which I cant explain. Basically I was trying to test what
> happens if I send data faster than the step size.
>
> \$> rrdtool create test.rrd --start 920804400 --step 5
> DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24
> \$> rrdtool update test.rrd 920804401:10 920804402:10 920804403:10
> 920804404:10 920804405:10
> \$> rrdtool update test.rrd 920804406:10 920804407:10 920804408:10
> 920804409:10 920804410:10
> \$> rrdtool update test.rrd 920804411:10 920804412:10 920804413:10
> 920804414:10 920804415:50
> \$> rrdtool update test.rrd 920804416:20 920804417:20 920804418:20
> 920804419:20 920804420:50
>
>
> \$> rrdtool fetch test.rrd AVERAGE --start 920804400 --end 920804500 speed
>
>  920804405: 0.0000000000e+00
>  920804410: 0.0000000000e+00
>  920804415: 8.0000000000e+00
>  920804420: 8.5899345920e+08

20 - 50 = - 30

since  you picked 'COUNTER' rrdtool assumes that the counter has
wrapped at 2^32

= 2^32 - 30
20 - 20 = 0
20 - 20 = 0
20 - 20 = 0
50 - 20 = 30

===============
2^32

2^32 / 5 = 8.5899345920e+08

>  920804430: -nan
>  920804435: -nan
>  920804440: -nan
> ...
>
> I dont understand how the value 8.5899345920e+08 is calculated. Could some

if you don't want the binary counter wrap detection use DERIVE with
a minimum rate of 0 ...

cheers
tobi

>
> RP2
>

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900

```