[rrd-users] Re: I need help to calculate % of max bandwidth !!!

Iain Buchanan iain at pcorp.com.au
Thu Apr 18 01:23:47 MEST 2002

----- Original Message -----
From: "Alex van den Bogaerdt" <alex at slot.hollandcasino.nl>
> Iain Buchanan wrote:
> > DEF:trend=data.rrd:bitsin:AVE
> > CDEF:pctrend=57600,trend,/,100,*
> > LINE1:pctrend
> > GPRINT:pctrend:AVE:%.2f
> You can skip the LINE1 here, unless you use it for other purposes.
I thought it was necessary for GPRINT but now I see (when I open my eyes!)
that it works from CDEF or DEF.

> 1) 56k is 56k, not 57.6k
1k = 1024b doesn't it?

> 2) the percentage is   trend/max * 100  , not   max/trend * 100
> So: CDEF:pctrend=trend,56000,/,100,*
> It can be changed into: CDEF:pctrend=trend,560,/
> This is because   x/y *100  == x/(y/100)
Personally I think its better to keep the code a bit bigger for the sake of
the over used word 'readability'.  Also, it would be easier to re-use if 56k
was a variable in some sort of script, to change it once in the code rather
than every occurence, in which case you may miss 560.  But thats just my
opinion!  Thanks for your corrections, I'm usually a bit lyxdesic with my


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