On Tue, 8 Apr 2003, Alex van den Bogaerdt wrote:

> On Mon, Apr 07, 2003 at 09:27:47PM +0200, Hugo van der Kooij wrote:
> 
> > Now the object is to make a CDEF string to return the following formula:
> > 
> > if ( 0.8 < (used/size) <= 0.95 ) {
> >     used+units
> > } else {
> >     0
> > )
> > 
> > I settled for:
> > 
> >         CDEF:normal=used,size,/,$BUSY,LT,used,units,*,0,IF      \
> >         CDEF:temp=used,size,/,$BUSY,GT,used,0,IF                        \
> >         CDEF:busy=used,size,/,$FULL,LT,temp,units,*,0,IF                \
> >         CDEF:full=used,size,/,$FULL,GT,used,units,*,0,IF                \
> > 
> > Where:
> > BUSY=0.8
> > FULL=0.95
> 
> This is one of many possible solutions.
> 
> I prefer something like:
> 
> value=used,size,/

s/value/fraction/

> normal=value,$BUSY,LE,value,$BUSY,IF
> busy=value,$BUSY,GE,value,$FULL,LE,value,$FULL,IF,UN,IF
> full=value,$FULL,GE,value,UN,IF

Add ... value=used,units,*

> and then
> 
> AREA:normal#00CC00
> STACK:busy#FFCC00
> FULL:full#FF0000
> 
> Unless I made a mistake while thinking or typing, this should do:
> 
> if value <= $BUSY
>    then normal:=value
>    else normal:=$BUSY
> if value >= $BUSY
>    then if value <= $FULL
>       then busy:=value
>       else busy:=$FULL
>    else busy=UNKNOWN
> if value >= $FULL
>    then full:=value
>    else full:=UNKNOWN

Should be:
 
if fraction <= $BUSY
   then normal:=value
   else normal:=$BUSY
if fraction >= $BUSY
   then if fraction <= $FULL
      then busy:=value
      else busy:=$FULL
   else busy=UNKNOWN
if fraction >= $FULL
   then full:=value
   else full:=UNKNOWN

The change is significant to make sure we do the right thing.

if (fraction != value) {
        sleep Alex
} else {
        sleep Hugo
}

Hugo.

-- 
 All email sent to me is bound to the rules described on my homepage.
    [EMAIL PROTECTED]           http://hvdkooij.xs4all.nl/
            Don't meddle in the affairs of sysadmins,
            for they are subtle and quick to anger.

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to