[rrd-users] Rrdtool for counting irregular events

Simon Hobson linux at thehobsons.co.uk
Fri May 25 13:30:16 CEST 2012


Rafal Gwizdala wrote:

>- How do you calculate monthly statistics? That is, how do you deal 
>with months having different numbers of days?

I don't. I deal with simplistic approximations instead. On my graphs 
I show about 7 week (because that's what fits neatly in the number of 
pixels, and show total bandwidth used for the previous 30 days (on a 
rolling basis).

If you want to deal in 'real' months then you'll need to do some work 
outside of RRD. It may involve calling RRD multiple times to get data 
from different timescales.
For example, if you want to plot total events by calendar month for 
the last year, then you'll need to do 12 queries to extract the data 
for each month, and then plot those values (probably better done 
outside of RRD). In fact, for that sort of usage, you may actually 
find a different storage system to be more suitable.

>- Does it mean the rrd file needs to start at the boundary of the 
>largest consolidation period, in your case at the beginning of  a 
>year? This way your consolidation period is aligned to calendar and 
>spans exactly a calendar

No, all periods (both primary and consolidated data points) have 
boundaries which are an integer multiple of the period (step size or 
step size * steps/CDP) since unix epoch (midnight, 1st Jan, 1970, 
UTC).
Thus a consolidation of 1 day will always start at midnight UTC 
regardless of your local timezone. So for me at the moment, my "days" 
start at 1am local as we're on summer time.

The start time in a database only determines the earliest timestamp 
of updates that may be used. Once you start updating, then the 
'start' of the database will move - there are simply N buckets of T 
time (both determined when you create the database) and the 'end' of 
the database is simply the timestamp of the last update. You're 
oldest data (ie 'start' of the database) will simply be that time 
less the cumulative length of all the buckets - and it is different 
for each consolidation.

-- 
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