[rrd-users] Need Help in rrdtool fetch AVERAGE

Simon Hobson linux at thehobsons.co.uk
Tue Nov 9 09:39:18 CET 2010

Top posting fixed

Ponnusamy, Sankar Kumar wrote:

>>  >#rrdtool fetch testing.rrd AVERAGE -r 300 -s 1289261655 -e 1289261975
>>  >1289261640: nan
>>  >1289261700: nan
>>  >1289261760: 0.0000000000e+00
>>  >1289261820: 0.0000000000e+00
>>  >1289261880: 0.0000000000e+00
>>  >1289261940: 0.0000000000e+00
>>  >1289262000: nan

>>And if you round your start and end times to be integer multiples of 300 ?

>Thanks for your reply Simon .  We already have rrd with 5-Mins of 
>AVERAGE and requirement is in addition 5-Mins I want to add 1-Mins 
>AVERAGE data too .
>I done added 1-Min AVERAGE in rrd config and now I want to fetch 
>1-Min AVG data to generate some report .
>Your approach like integer multiples of 300 is good approach but you 
>know this will require lot of code changes in existing 5-Mins 
>process.  thats the reason I trying with --resolution 60/300 for 
>fetch corresponding data . So would be great if you can help me to 
>fix with -r option .

OK, you've not understood what I said.

It's nothing to do with what you're storing, it's the times you're 
giving to RRD Fetch. Try this instead :
   rrdtool fetch testing.rrd AVERAGE -r 300 -s 1289261400 -e 1289262000

Note how both start and end times are on 300s step boundaries. I 
suspect that because you specified start and end times, RRD is trying 
to supply as much data as it can that is within those times, and that 
means using the higher resolution CDPs.
The same issue arises when graphing, results are more predictable if 
the start/end times are multiples of the data bucket size.

In RRD, ALL times are relative to Unix epoch (Midnight 1st Jan 1970 
UTC) - and data is stored in buckets that start/end on a timestamp 
which is an integer multiple of the bucket length. So data 
consolidated into 300s periods will always use periods whose 
timestamp is an integer multiple of 300.

1289262000 is a multiple of 300, 1289261975 is not.

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