# [rrd-users] Re: something missing ..

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Jul 16 22:34:18 MEST 2003

```On Wed, Jul 16, 2003 at 02:01:32PM -0600, Fitzgerald, David wrote:

> Ideally, a value of 2 would be designated by a green region, a value of
> 1 would be blue, and a value of 3 would be red.
>
> At present, the value of the variable is as follows:
>
[snip values exactly 1,2 or 3]

Looking good.  You do insert the values on one minute intervals and do
not get bitten by interpolation.  However, since not all significant
digits are actually displayed there still is a chance you're really
looking at 1.00000000000001 and similar values.

> The following snippet gets me a graph that seems to have a value of 3
> for all time periods, when it should be 2.

Your example does not show the time to pixel ratio.  Maybe RRDtool
is calculating an average (avg(2,2,2,3)==2.25). Maybe not.

>     \$graph2 = "DEF:status=\$rrdfile:status:AVERAGE ";

get the rate, store into "status"

>     \$graph3 = "CDEF:unknown=status,0,EQ,0,0,IF ";

status,0,EQ ===>  true or false

if (status==0) then return 0 else return 0. --> always 0

>     \$graph4 = "CDEF:syncing=status,2,LT,0,status,IF ";

status,2,LT ===>  true or false

if (status<2) then return 0 else return status

>     \$graph5 = "CDEF:active=status,2,EQ,0,status,IF ";

status,2,EQ ===> true or false

if (status==2) then return 0 else return status

>     \$graph6 = "CDEF:inactive=status,2,GT,0,status,IF ";

status,2,GT ===> true or false

if (status>2) then return 0 else return status

>     \$graph7 = "AREA:active#00FF00:Active ";
>     \$graph8 = "AREA:syncing#0000FF:Syncing ";
>     \$graph9 = "AREA:inactive#FF0000:Inactive ";

You don't seem to do anything with "unknown".  Why bother to do that CDEF?

Display: active; display 0 if the rate==2, else display the rate
This seems backwards.  Dito for the other items.

I think you got "if" the wrong way around.

a,b,c,IF ==> if (a==true) then return b, else return c.

You need to display (for instance) 3 only if rate==3.

Do not forget to compensate for small fractions (the 1.000000000001).

HTH
Alex
--
Received on my linux server: "Increase the speed of your PC in minutes! Stop
windows from crashing, improve internet security and optimize your computers
performance with just a few easy mouse clicks!"

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