[rrd-users] Re: GPRINT:time_max_c:AVERAGE

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Oct 23 13:47:58 MEST 2002


On Wed, Oct 23, 2002 at 01:27:09PM +0200, Mauro wrote:

> hy,
> There is a mode for make the average in the rdd graph that don't considers
> the values 0 (zero) ?

No, but there may be a similar solution for you.
AFAIK RRDtool will skip unknown values.  You can use this to your
advantage by altering every occurance of 0 into NaN.

The average function will do this:
  sum(all rates not equal to NaN) / count(all intervals not rate==NaN)

The average of (0,10,20,30) is (0+10+20+30)/4
and the average of (NaN,10,20,30) is (10+20+30)/3

    DEF:myval=   ...
    CDEF:altered=myval,0,EQ,UNKN,myval,IF
    PRINT:myval:AVERAGE:"The real average is %6.2lf\n"
    PRINT:altered:AVERAGE:"The modified average is %6.2lf\n"

The cdef does this:
  if (myval == 0)
    then return an unknown
    else return the value of myval

HTH
Alex

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list