[rrd-users] problem with plotting unkown data

Alex van den Bogaerdt alex at ergens.op.het.net
Mon Feb 12 14:58:15 CET 2007

On Mon, Feb 12, 2007 at 01:37:51AM +0100, Bernd Kuhlen wrote:
> Hi,
> I want to plot the number of processes on my server, defining fewer  
> than 80 as ok, 80-120 as critical and more than 120 as overload.
> Here's how I try to plot it:
> /usr/local/bin/rrdtool graph /path/to/png/myserver.proc-6h.png -- 
> start -21600 \
> -t "myserver (6h number of processes, 5min intervals)" \
> --lower-limit 0 \
> --vertical-label "number of processes" \
> DEF:nproc=/path/to/rrd/database/myserver.proc.rrd:nproc:AVERAGE \

> "CDEF:newproc=nproc" \

Why this one? It seems redundant?

for values being unknown:

> CDEF:ok=newproc,$PROCCRITS,GT,$PROCCRITS,newproc,IF \

if newproc>80 then 80 else newproc  -> should result in UNKN

> CDEF:many=newproc,$PROCCRITS,GT,newproc,$PROCCRITS,-,0,IF \

if newproc>80 then newproc-80 else 0  -> should result in 0

> CDEF:over=newproc,$PROCCRITH,GT,newproc,$PROCCRITH,-,0,IF \

if newproc>120 then newproc-120 else 0

> AREA:ok#0000FF:"ok" \
> STACK:many#FFFF00:"critical" \
> STACK:over#FF0000:"overload"

should result in area unknown, stack 0 on top, stack 0 on top.
Stacking on top of unknown doesn't happen -> no data visible.

The source from 1.2.15, which does exactly as I expect:

Two values on the stack: newproc in s[stptr-1] and 80 in s[stptr].

            case OP_GT:
                if (isnan(rpnstack -> s[stptr-1]))
                else if (isnan(rpnstack -> s[stptr]))
                    rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
                    rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >
                                        rpnstack -> s[stptr] ? 1.0 : 0.0;

    if the stack isn't large enough, report an underflow.
    if the first value is not a number, return that one
    if the second value is not a number, return that one
    return 1 if the first value is larger than the second one, else 0.
    adjust the stacksize

Which version of RRDtool are you running?

>From your description, it seems "ok=newproc,$PROCCRITS,GT" results
in true if newproc is unknown.  You can test this by making all your
data unknown:  CDEF:newproc=nproc,POP,UNKN (change the redundant line).
Then (temporarily) remove CDEFs many and over, including displaying
them with STACK.  This leaves CDEF ok, including its AREA.

Of course, it could be something completely different, I can be
missing something as well here...

Further debugging could include: plotting newproc as a black line,
plotting ok as a black line (do these both after plotting the area),
changing all values into zero (CDEF:newproc=nproc,POP,0)

Alex van den Bogaerdt

More information about the rrd-users mailing list