[drraw-users] question regarding perl based DS and addition

eliott eliott at cactuswax.net
Mon Jan 5 21:15:36 MST 2009


I am trying to use the perl regex based DS to graph cpu rrds.
The problem I am running into, is the forumula + or AVERAGE when only
one cpu is present on a box. Some boxes have 4. Others have one. Some
of the boxes with 4 cpus don't provide all the data for each of the
points (lets say cpu-4 on a host is the only cpu with any 'nice' cpu
data).

I get the following on boxes with one cpu, or many cpus where only one
of 4 cpus has a datapoint:
  invalid rpn expression in: e0,UN,0,e0,IF,,+

Here is the generated graph output.

rrdtool graph - \
 --start=end - 1 day \
 --end=now \
 --imgformat=PNG \
 --width=500 \
 --base=1000 \
 --height=120 \
 --interlaced \
 DEF:d0=/var/lib/collectd/rrd/host/cpu-0/cpu-idle.rrd:value:AVERAGE \
 DEF:d1=/var/lib/collectd/rrd/host/cpu-1/cpu-idle.rrd:value:AVERAGE \
 DEF:d2=/var/lib/collectd/rrd/host/cpu-2/cpu-idle.rrd:value:AVERAGE \
 DEF:d3=/var/lib/collectd/rrd/host/cpu-3/cpu-idle.rrd:value:AVERAGE \
 DEF:c0=/var/lib/collectd/rrd/host/cpu-0/cpu-interrupt.rrd:value:AVERAGE \
 DEF:c1=/var/lib/collectd/rrd/host/cpu-2/cpu-interrupt.rrd:value:AVERAGE \
 DEF:e0=/var/lib/collectd/rrd/host/cpu-2/cpu-nice.rrd:value:AVERAGE \
 DEF:f0=/var/lib/collectd/rrd/host/cpu-0/cpu-system.rrd:value:AVERAGE \
 DEF:f1=/var/lib/collectd/rrd/host/cpu-1/cpu-system.rrd:value:AVERAGE \
 DEF:f2=/var/lib/collectd/rrd/host/cpu-2/cpu-system.rrd:value:AVERAGE \
 DEF:f3=/var/lib/collectd/rrd/host/cpu-3/cpu-system.rrd:value:AVERAGE \
 CDEF:d=d0,UN,0,d0,IF,d1,UN,0,d1,IF,+,d2,UN,0,d2,IF,+,d3,UN,0,d3,IF,+,4,/ \
 CDEF:c=c0,UN,0,c0,IF,c1,UN,0,c1,IF,+,2,/ \
 CDEF:e=e0,UN,0,e0,IF,,+ \
 CDEF:f=f0,UN,0,f0,IF,f1,UN,0,f1,IF,+,f2,UN,0,f2,IF,+,f3,UN,0,f3,IF,+,4,/ \
 AREA:f#FF0000:system

As you can see, cpu-2 is the only one with any 'nice' data rrds.

Notes:
file re: ^.*/host/cpu-([0-9]+)/cpu-nice\.rrd$
ds: value
element: UN,0,$,IF
Formula: +    (I have tried AVERAGE here too)

My hope was to have a single template that I could apply to boxes with
1 cpu, as well as boxes with 4 cpus. Addition in rpn of course
requires two items on the stack.

Has anyone found a way to work around this issue, without resorting to
creating a separate template?



More information about the drraw-users mailing list