[rrd-users] Re: rpn expression question

Alex van den Bogaerdt alex at ergens.op.het.net
Mon Sep 26 13:32:38 MEST 2005


On Mon, Sep 26, 2005 at 02:39:57PM +0400, Alex Ustyancev wrote:
> 
> Hi all.
> 
> I need to create a complex rpn expression. In two words, it calculates
> a value, everything is easy. But one small problem. In expression
> formula I need to devide one value by another. And the devider
> sometimes could be zero. As far as i know, rrd rpn sets the result of
> devision by zero as INFINITY. But in that case i need to set result as
> 0. So i try such RPN expression:
> {my_result_value_which_could_be_infinity},DUP,ISINF,EXC,0,EXC,IF
> 
> But that doen't work. There is no graph at all shown.

No graph at all, or a graph with all zero ?

> Afaik it means, that there is a mistake in rpn expression.

Or you have made an error in reasoning.  This could be somewhere else
in your script or even in the input data.

> What's wrong with that expression?

CDEF:dst=src,DUP,ISINF,EXC,0,EXC,IF

The stack (where <src> could be unknown):
<src>
<src><src>
<src><isinf(src)>
<isinf(src)><src>
<isinf(src)><src><0>
<isinf(src)><0><src>
<if isinf(src) then 0 else src>

Seems fine to me.  If you made a mistake here, I'm making the same one.

Other things to verify:
- is <src> what you think it is? maybe <dst> becomes all NaN or all zero?
- are you graphing the correct vname?
- are you plotting a color, not the same as the background color?

You expect the same numbers as src, but with any INF changed into zero.
Verify that!  Try GPRINTing the minimum, average, maximum and last value.
Do this for both src and dst.

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

--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list