[rrd-users] Fetching from the beginning of an RRD file

Simon Hobson linux at thehobsons.co.uk
Fri Mar 2 09:05:55 CET 2007

Travis Spencer wrote:

>  > There is a pointer to the last entry written.  That's the most recent
>>  available data.  Next to it is older, next to that one is older, and
>>  so on.  When you are back at the pointer, you have seen all available
>>  data.
>While I have no doubt that is how RRD handles things internally, I was
>thinking of it more like this: Each RRD file is a database.  That
>database contains one table for each CF (e.g., AVERAGE, MIN, etc.).
>Each table has a number of columns (e.g., DS, DST, timestamp, etc.).
>Given all of this, I was thinking of my initial example:
>rrdtool fetch foo.rrd AVERAGE -s 0
>to be analogous to this SQL:
>Perhaps I'm looking at this wrong

Yes, as Alex pointed out this is RRD which is a special type of 
'database' with different rules. Each table is a fixed number of rows 
which are used in a round robin manner (hence the name).

What happens when you try and fetch data for a specific range is :
rrdtool looks at the database and the time range requested, it 
attempts to find a store which covers the entire range, and if there 
is more than one candidate, returns the one with the best resolution. 
This way you can automatically get (say) 5 minute resolution for the 
last few hours or (say) 2 hour resolution for the last few weeks.

The other difference is that whenever you retrieve data, you will 
always get rows that are evenly spaced from 'start' to 'end'.

>however, even if RRD is storing its
>data internally in a wheel-like structure, I would think that all of
>that data would be returned if I ask it to fetch me its averages that
>were entered more recently than epoch.

No, it fails because there is no store containing data going back 
that far - so the only thing it can do is fail. The only other option 
would be to return a very large number of 'unknown' values to to make 
stuff up !

More information about the rrd-users mailing list