[rrd-users] Graph Question - average of maximum's
Alex van den Bogaerdt
alex at ergens.op.het.net
Sun Mar 23 14:48:49 CET 2008
On Sat, Mar 22, 2008 at 11:24:20PM +0100, Peter Hall wrote:
> I need to obtain the average of the maximum's that have been collected
> over a period of time.
> I have 6 RRD's that have been created with the following command, 1 for
> each system...
>
> rrdtool create statistics.rrd --start 1203393659 --step 60 \
> DS:smh_da:GAUGE:60:1:U \
> RRA:AVERAGE:0.5:1:302400 \
> RRA:MIN:0.5:1440:60 \
> RRA:MAX:0.5:1440:60
Good. Maximums are present.
> rrdtool graph delivery.png --title "Total Delivery Rate (Test)" \
> DEF:smvs41m=$base/smvs41/statistics.rrd:smh_da:MAX \
> DEF:smvs61m=$base/smvs61/statistics.rrd:smh_da:MAX \
> DEF:smvs81m=$base/smvs81/statistics.rrd:smh_da:MAX \
> DEF:smvs51m=$base/smvs51/statistics.rrd:smh_da:MAX \
> DEF:smvs71m=$base/smvs71/statistics.rrd:smh_da:MAX \
> DEF:smvs91m=$base/smvs91/statistics.rrd:smh_da:MAX \
> CDEF:totalm=smvs41m,smvs61m,+,smvs81m,+,smvs51m,+,smvs71m,+,smvs91m,+ \
totalm is an array of sums of all maximums. For instance: look at
smvs41m as an array:
smvs41m[0]=some value
smvs41m[1]=some value
smvs41m[2]=some value
... and so on.
Dito for the other data sources.
Now totalm is an array of sums:
totalm[0]=smvs41m[0]+smvs61m[0]+smvs81m[0]...91m[0]
totalm[1]=smvs41m[1]+smvs61m[1]+smvs81m[1]...91m[1]
... and so on
> VDEF:smh_ave=totalm,AVERAGE \
smh_ave is the average of the values in totalm ...
> GPRINT:smh_ave:" %5.0lf" \
... and is printed.
Summary: you are printing the average of the sum of the maximums for
each datasource, for each time interval. The number will be 600% of
what you expect.
It seems to me that you want something different:
CDEF:avgmax1=smvs41m,smvs61m,smvs81m,smvs51m,smvs71m,smvs91m,AVG
VDEF:avgmax2=avgmax1,AVERAGE
This will, for each time interval, compute an average of each maximum
(the CDEF), and then compute an average of those averages (the VDEF).
HTH
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-users
mailing list