# [rrd-users] Re: CDEF problems

Olivier Daury odaury at epo.nl
Wed Mar 29 13:45:50 MEST 2000

```

Hi,

John wrote:
>
> My RPN is weak,
> What I need to be able to say is
> if  var1 is < 5 and var1 > 2.5 then true
> else
> if var1 is < 7.5 and var1 >=5 then true
> else
> if var1 is < 10 and var1 >=7.5 then true
> Thanks
> + Regards

Just a little problem with what you want to do exactly. If I write it again,
I have:
2.5 <  var1 < 5   => true
5   <= var1 < 7.5 => true
7.5 <= var1 < 10  => true
This is equivalent to 2.5 < var1 < 10 => true
May be you want to push a different result for each 'IF'

Anyway: try this:
CDEF:result1=var1,2.5,GT,var1,5,LT,AND,1,0,IF
or with a temp variable:

CDEF:test1=var1,2.5,GT,var1,5,LT,AND
CDEF:test2=var1,5,GE,var1,7.5,LT,AND
CDEF:test3=var1,7.5,GE,var1,10,LT,AND
CDEF:result1=test1,1,0,IF
CDEF:result2=test2,1,0,IF
CDEF:result3=test3,1,0,IF

I didn't remember if 'AND' operator exists for RRD... If not, you must use two 'IF'

Hope this help,

Oliver somewhere in The Hague
--
__________________________________________________________________
mailto:olivier at daury.net ~ ICQ#: 18503104 ~ PGP key id: 0xC9976DCD
slamp on Undernet ~ Phone:(+31) 70 340 38 32 ~ AIM: slamp at chez.com

Murphy's Seventh Law: Left to themselves, things tend to go from bad to worse.

--
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

```