[rrd-users] Fetching 5 minute max values from RRDs
Alex van den Bogaerdt
alex at ergens.op.het.net
Thu Oct 18 10:48:53 CEST 2007
On Wed, Oct 17, 2007 at 05:33:13PM -0700, William Cassis wrote:
> Hello,
>
> I'm trying to extract the max values for each 5 minute sample from an
> rrd file, but I've noticed that the values returned for max are the same
> as the values for average:
[snip]
> MRTG used to store the average in/out and then the max in/out for each 5
> minute sample in the log file.
OK.
> Is there any way to get the 5 minute max
> from an rrd file?
time hh:00, time hh:05 are in the log file (mrtg) or the RRD.
You update at time hh:57, hh:02 and hh:07.
The resulting rate between hh:57 and hh:02 is 3000.
The resulting rate between hh:02 and hh:07 is 0.
Normalization then computes: 2 out of 5 minutes @3000, 3 out of 5 @0.
This is 2/5*3000 + 3/5*0 = 1200.
This one rate is then "consolidated" into an RRA which uses one PDP
per CDP:
max(1200) = 1200
avg(1200) = 1200
But what you want is possible!
set step to 1 second.
create an AVERAGE and a MAX RRA, using 300 steps per PDP.
This means normalization doesn't alter those values.
Consolidation will then store 3000 in the MAX RRA.
--step 1
DS:in:COUNTER:600:0:12500000
DS:out:COUNTER:600:0:12500000
RRA:AVERAGE:0.5:1*300:600 RRA:MAX:0.5:1*300:600
RRA:AVERAGE:0.5:6*300:700 RRA:MAX:0.5:6*300:700
RRA:AVERAGE:0.5:24*300:775 RRA:MAX:0.5:24*300:775
RRA:AVERAGE:0.5:288*300:797 RRA:MAX:0.5:288*300:797
You need to fill in 86400 instead of 288*300 and so on. I just wrote
it like this for demonstration purposes. Normally you would have 797
rows of 288 steps of 300 seconds each, now you're going to create 797
rows of 86400 steps of 1 second each.
The amount of time is the same: 797 * 288 * 300 = 797 * 86400 * 1.
The amount of work for RRDtool is not much more (if at all).
time hh:00, time hh:05 are in the RRD.
You update at time hh:57, hh:02 and hh:07.
The resulting rate between hh:57 and hh:02 is 3000.
The resulting rate between hh:02 and hh:07 is 0.
These rates are valid for all ${step} intervals. Now RRDtool
is going to consolidate 300 of such intervals into one PDP:
max(3000,3000,3000, ... , 0, 0, 0) = 3000
avg(3000,3000,3000, ... , 0, 0, 0) = 1200
HTH
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list