[rrd-developers] RPN workaround to decrease IFs

Maris Janis Vasilevskis mahris at myself.com
Mon May 16 10:32:07 CEST 2011


rrdtool create causes segmentation fault on COMPUTE with 4 IFs, but work with 3 IFs
(my environment: Centos 5.5, tested with RRD 1.4.4 and 1.4.5).
For one of possible workarounds, I should be sure about result of UNKN,0,/ - UNKN or INF?
Another ideas welcomed.

The task is elementary: computed cpuperc=cpuused/cpuall*100
4 data checks required:
1) cpuused unknown - result unknown
2) cpuall unknown - result unknown
3) cpuused>cpuall - bad data, result unknown
4) cpuall=0 - result 0
When I implement them using IF, segmentation fault occurs.

If I remove any of 4 IFs, create works normally.

A full sample causing segfault:
rrdtool create x1.rrd \
DS:cpuused:DERIVE:600:0:U \
DS:cpuall:DERIVE:600:0:U \
DS:cpuperc:COMPUTE:cpuused,UN,UNKN,cpuall,UN,UNKN,cpuused,cpuall,GT,UNKN,cpuall,0,EQ,0,cpuused,cpuall,/,100,*,IF,IF,IF,IF \

Thank you,

More information about the rrd-developers mailing list