CDEF-function for reverse percents

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
alibek
Posts: 33
Joined: Tue Sep 14, 2010 9:35 am

CDEF-function for reverse percents

Post by alibek »

Text automatically translated, sorry for the clumsy text.

There is a data source that returns the parameter cpuIdle (from 99 to 1).
Want to display the graph utilization CPU (formula "100-cpuIdle").
Use next CDEF-function:

Code: Select all

cdef = CURRENT_DATA_SOURCE, UN, UNKN, 100, CURRENT_DATA_SOURCE, -, IF
However, the schedule is displayed incorrectly, displays 100%.
What is wrong with this formula?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

please remove the blanks. I'm not sure whether cacti does this. RRDTool does not accepts blanks in CDEFs
R.
alibek
Posts: 33
Joined: Tue Sep 14, 2010 9:35 am

Post by alibek »

Sorry.
The spaces were inserted in the copy-paste, in fact they are not.
Formula is:

Code: Select all

cdef=CURRENT_DATA_SOURCE,UN,UNKN,100,CURRENT_DATA_SOURCE,-,IF
Debug output is:

Code: Select all

/opt/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='SW-BLHNV39-01 (IP 10.1.9.101)' \
--rigid \
--base=1000 \
--height=180 \
--width=600 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label= \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/cybercom/web/sites/default/cacti/rra/17/105.rrd":q_cpu_idle:AVERAGE \
DEF:b="/cybercom/web/sites/default/cacti/rra/17/106.rrd":q_mem_idle:AVERAGE \
DEF:c="/cybercom/web/sites/default/cacti/rra/17/107.rrd":q_mem_size:AVERAGE \
DEF:d="/cybercom/web/sites/default/cacti/rra/17/109.rrd":q_temp_current:AVERAGE \
DEF:e="/cybercom/web/sites/default/cacti/rra/17/110.rrd":q_temp_threshold:AVERAGE \
DEF:f="/cybercom/web/sites/default/cacti/rra/17/108.rrd":q_ping:AVERAGE \
CDEF:cdefa=a,UN,UNKN,100,a,-,IF \
LINE2:cdefa#FF0000FF:"CPU Utilization"  \
GPRINT:cdefa:LAST:"Current\:%8.0lf"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:cdefa:MAX:"Max\:%8.0lf\n"  \
AREA:b#C0C0C0FF:"Memory Used"  \
GPRINT:c:AVERAGE:"    Memory Size\:%8.2lf%s\n"  \
LINE1:d#FFAB00FF:"Temperature"  \
GPRINT:d:LAST:"    %8.2lf%s"  \
GPRINT:d:MAX:"Max\:%8.2lf%s"  \
LINE2:e#CCBB00FF:"Threshold"  \
GPRINT:e:LAST:"      %8.2lf%s\n"  \
LINE1:f#00BD27FF:"Ping (ms)"  \
GPRINT:f:LAST:"      Current\:%8.2lf%s"  \
GPRINT:f:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:f:MAX:"Max\:%8.2lf%s\n"  \
VRULE:1284408000#0000007F:"" 
availablezone14
Posts: 1
Joined: Wed Sep 15, 2010 12:45 am
Contact:

Post by availablezone14 »

THANKS :D :D
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests