[rrd-users] rpn question

Alex van den Bogaerdt alex at ergens.op.het.net
Sat May 10 23:39:27 CEST 2008


On Sat, May 10, 2008 at 01:22:53PM -0400, R Dicaire wrote:
> Hi folks, I have the following RPN statement, seems to work but I'm
> requesting clarification on its output.
> 
> CDEF:apacherpn=apache_bytes,20000,GT,apache_bytes,10,/,apache_bytes,IF

if apache_bytes > 20000 return apache_bytes/10
else return apache_bytes


> If apache_bytes is say, 30000, is the output then 3000 or 21000?

3000

> My aim was to have all values above 20000 be divided by 10, but the
> 20000 floor remain 20000.

You _are_ dividing all values above 20000 by 10.  But it seems to
me you want to divide only the portion above 20000 by 10 and add
this to 20000.

1:  Why ?

2:  that requires a more complex formula.


> So 30000 would be displayed as 21000. Is this even possible?

Sure.

if (x>20000) then return (x-20000)/10+20000
else return x

and then transform this into RPN.

-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the rrd-users mailing list