[rrd-users] Special Formula Help?

Simon Hobson linux at thehobsons.co.uk
Tue Mar 27 01:22:59 CEST 2007

Wintle, Rod wrote:

>I have a router interface setup in cacti to poll ever 5 minutes.
>Each hour, I want to roll that 12 x 5 minute values into a average
>Each day, I want to take the 8 largest 1 hour averages (busiest 8 
>hours) and create a value that would represent the value for the day.

I don't think you'll be able to do that directly in rrd, but it 
should be fairly easy with a bit of scripting.

Firstly, you can roll up your 5 minute samples by defining an RRA in 
your database - then rrd will take care of it for you.

Then what I suggest is you write a script that will dump the values 
from the database, sort the value and take the largest 8, and then 
feed the result back into a different rrd. You can then run this 
script a little after midnight each day. For the timestamp use the 
midnight just passed.

Be aware that you cannot go back and 'fill in' missing values so for 
refinement, to take care of missed script runs, you might want to 
look at last time you updated the daily record and go back to cover 
that day and the following ones until now. Eg, if today is 26th and 
you last updated the daily rrd on 22nd, then you would need to do 
your daily run for 22nd, 23rd, 24th, and 25th. The run for the 26th 
will be done on the 27th.

That's one hint, I'll leave you to figure out the details - mostly 
because it's beyond my rrd basics !

More information about the rrd-users mailing list