[rrd-users] Re: help with cdef

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Aug 15 11:34:37 MEST 2004

On Sat, Aug 14, 2004 at 10:20:16AM -0700, winkey wrote:

> i cannot seem to figure this out, i get results i do not expect
> rrdtool graph \
>         /home/rush/public_html/weather/metar/dir.gif \
>         --color=BACK#FFFFCC \
>         --color=CANVAS#CCFFFF \
>         --title="Daily Wind Direction" \
>         --width=300 \
>         DEF:dir=/home/rush/public_html/weather/metar/weather.rrd:winddir:AVERAGE \
>         DEF:speed=/home/rush/public_html/weather/metar/weather.rrd:windspeed:AVERAGE \
>         CDEF:calm=speed,0,EQ \
>         CDEF:mydir=calm,UNKN,dir,IF \
>         LINE2:mydir#00a000:"Degrees"
> basicly if speed is zero i want an unknown value for direction but i
> seem to be ending up with unknowns for speeds greater than zero and
> other anomolys

EQ gives a boolean as result.  "calm=speed,0,EQ" results in:

if speed==0
   then return true
   else return false

Next you are using that boolean in an if-then-else:

if calm
   then return UNKN
   else return direction

The end result will be:

if (speed==0)
   then return unknown
   else return direction.

This matches what you expect.  If the result is not what you expect,
most likely the input is not what you think it is.


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