# [rrd-users] Re: GPRINT max/average discrapancies

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Tue Dec 4 00:55:09 MET 2001

```Day Dreamer wrote:

> I believe that the thought behind 14all.cgi is that
> when a MAX'd value occur, the MAX'd percentage in
> relation to the raw BW should also correspond to the
> same data point.  So, if the summarized MAX's data out
> of MAX RRA point at time "A", the independently
> calculated MAX'd percentage based on the AVERAGE RRA
> should apply to the same data point "A".

Unless I misinterpreted your problem, you are not seeing
the maximum.  You are seeing the maximum of the averages.
The averages will change if they are consolidated.

A simplified example:

You have 10 numbers:  { 0 0 0 0 0 0 0 0 10 0 }
These numbers are consolidated into one, because each pixels shows
10 numbers at a time: (0+0+0+0+0+0+0+0+10+0)/10 = 1
All other pixels are 0.
If you are printing max(averages) you will change the 10 into 1.
If you would work with the maxima then {0 0 0 0 0 0 0 0 10 0} would
be consolidated into { 10 } and max(maxima) is 10.

This is why I wrote you need to have some extra lines in the script.

The key here is that your data is consolidated using the AVERAGE
function, this is flattening the graph.  Normally this is correct
as the product of rate and time should still be the same.  However,
for knowing maxima (and minima) this is bad.  So, for graphing the
data you should use the AVERAGE consolidation function.  To print
the maximum average as visible on the graph you should print the
maximum of all (consolidated) averages.  To show the maximum of the
stored rates, you should print the maximum of the maxima.

example:
DEF:avg=some.rrd:DS0:AVERAGE
DEF:max=some.rrd:DS0:MAX
PRINT:avg:MIN:"%6.2lf %sbps\n"
PRINT:avg:AVERAGE:"%6.2lf %sbps\n"
PRINT:avg:MAX:"%6.2lf %sbps\n"
PRINT:max:MIN:"%6.2lf %sbps\n"
PRINT:max:AVERAGE:"%6.2lf %sbps\n"
PRINT:max:MAX:"%6.2lf %sbps\n"
If the input data is { 1 2 3 4 5 6 7 8 9 10 } and this is plotted
in two pixel columns, it will be consolidated into:
- for avg:  { 1 2 3 4 5 } --> 3, { 6 7 8 9 10 } --> 8
- for max:  { 1 2 3 4 5 } --> 5, { 6 7 8 9 10 } --> 10
The PRINT commands should print:
- MIN(avg) == 3
- AVG(avg) == 5.5
- MAX(avg) == 8
- MIN(MAX) == 5
- AVG(MAX) == 7.5
- MAX(MAX) == 10
If the input data is plotted on 10 pixel columns, it will not need
to be consoldated so it stays { 1 2 3 4 5 6 7 8 9 10 }.  The output:
- MIN(avg) == 1
- AVG(avg) == 5.5
- MAX(avg) == 10
- MIN(MAX) == 1
- AVG(MAX) == 5.5
- MAX(MAX) == 10

cheers,
--
__________________________________________________________________
/ alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users