[rrd-users] Questions of new user

Simon Hobson linux at thehobsons.co.uk
Sun Dec 6 17:25:10 CET 2009


Pavel Rubtsov wrote:

>But there is some misunderstanding:
>
>C:\rrd\rrdtool.exe create test.rrd --start N --step 300 ^
>DS:test:GAUGE:600:0:100 ^
>RRA:AVERAGE:0.5:12:1
>
>C:\rrd\rrdupdate.exe test.rrd ^
>1260113100:10 ^
>1260113400:20 ^
>1260113700:30 ^
>1260114000:40 ^
>1260114300:50 ^
>1260114600:60 ^
>1260114900:70 ^
>1260115200:80 ^
>1260115500:70 ^
>1260115800:60 ^
>1260116100:50 ^
>1260116400:40
>
>Result:
>1260111600: nan
>1260115200: 4.1111111111e+01
>1260118800: nan
>
>But (10+20+...+50+40)/12 = 48,3! Why?

You have your periods wrong - your first completed consolidation 
period is at 1260115200 (Sun  6 Dec 2009 16:00:00 GMT) and started at 
1260111600 (Sun  6 Dec 2009 15:00:00 GMT). So you only have 9 
complete step periods for which you have data. Remember that all 
intervals are "n * s" from unix epoch - ie a whole multiple of the 
step size (or in this case, step size times steps per consolidated 
data point). Put simply, if the step (or ocnsolidation) is one hour, 
then all intervals start on the hour - nn:00:00.

You have the following values in the consolidated interval :

Unknown * 3
10
10
20
30
40
50
60
70
80
So for the average rate for this period is (10+10+20+..+70+80)/9 = 41.1111

Or really, the calculation is :
(10* 300 + 10*300 + 20*300 + 30*300 + ... + 70*300 + 80*300) / 2700
Remember that rrdtool only ever works in rates, so a gauge value of 
30 for 300 seconds is really a rate of 0.1. 2700 is simply 9x300 - ie 
you've got data for 9 step times of 300 seconds.

Why are there two entries of 10 in that calculation ? Your first 
update comes after all the data is unknown. You've configured your DS 
to allow up to 600 seconds between samples before the data is unknown 
- therefore your first update of 10 actually works out to "the data 
for the previous 2 sample periods (600/300) is "10". If you didn't 
want that then you'd need to set an initial value (eg update with 
1260112800:0) to explicitly set a start boundary to your data.

That last bit isn't a statement based on profound knowledge or 
examination of the source code - it's what the numbers work out to 
and is logically consistent with the documentation !

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the rrd-users mailing list