[HOWTO] Color coded percent utilization
Moderators: Moderators, Developers
 gandalf
 Developer
 Posts: 22375
 Joined: Thu Dec 02, 2004 2:46 am
 Location: Muenster, Germany
 Contact:
Please have a look at the rrdtool graph statements (select the wrench ...). If it occurs to be the same strange thing as above (2 lines containing a backslash only), then the answer is: yes. There's a solution (I've posted a bug report and appended a patch, see http://bugs.cacti.net/view.php?id=585).
Reinhard
Reinhard
 TheWitness
 Developer
 Posts: 14817
 Joined: Tue May 14, 2002 5:08 pm
 Location: MI, USA
 Contact:
lvm, and others monitoring this post, please try the attached rrd.php and let me know if it fixes the problem...
TheWitness
TheWitness
 Attachments

 rrd.zip
 (10.85 KiB) Downloaded 490 times
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
TheWitness  I have applied the file you posted, but I am getting the same results in my graphs.
/usr/local/bin/rrdtool graph  \
imgformat=PNG \
start=86400 \
end=300 \
title="Circuit Utilization  Summary  FastEthernet0/1" \
base=1000 \
height=120 \
width=500 \
altautoscalemax \
lowerlimit=0 \
verticallabel="Percent" \
slopemode \
DEF:a="/usr/local/www/*********/webfiles/rra/pgabcr1_20ws2950_traffic_in_1590.rrd":traffic_in:LAST \
DEF:b="/usr/local/www/*********/webfiles/rra/pgabcr1_20ws2950_traffic_in_1590.rrd":traffic_out:LAST \
CDEF:cdefa=a,100000000,/,100,*,8,* \
CDEF:cdefb=b,100000000,/,100,*,8,* \
CDEF:cdefc=a,b,+,100000000,/,100,*,8,*,10,LE,a,b,+,100000000,/,100,*,8,*,0,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,b,+,100000000,/,100,*,8,*,30,LE,a,b,+,100000000,/,100,*,8,*,20,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,b,+,100000000,/,100,*,8,*,50,LE,a,b,+,100000000,/,100,*,8,*,40,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,b,+,100000000,/,100,*,8,*,70,LE,a,b,+,100000000,/,100,*,8,*,60,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,b,+,100000000,/,100,*,8,*,90,LE,a,b,+,100000000,/,100,*,8,*,80,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,b,+,100000000,/,100,*,8,*,20,LE,a,b,+,100000000,/,100,*,8,*,10,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,b,+,100000000,/,100,*,8,*,40,LE,a,b,+,100000000,/,100,*,8,*,30,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,b,+,100000000,/,100,*,8,*,60,LE,a,b,+,100000000,/,100,*,8,*,50,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,b,+,100000000,/,100,*,8,*,80,LE,a,b,+,100000000,/,100,*,8,*,70,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,b,+,100000000,/,100,*,8,*,5000,LE,a,b,+,100000000,/,100,*,8,*,90,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbe=a,8,* \
CDEF:cdefce=b,8,* \
\
\
:cdefc#3ACE0C:" 0  10%":STACK \
:cdefd#99FF99:"20  30%":STACK \
:cdefe#ffff00:"40  50%":STACK \
:cdeff#FF8C1A:"60  70%":STACK \
:cdefg#FF3333:"80  90%\n":STACK \
:cdefh#00FF00:"10  20%":STACK \
:cdefi#FFFF80:"30  40%":STACK \
:cdefj#FFA54C:"50  60%":STACK \
:cdefba#FF5F00:"70  80%":STACK \
:cdefbb#FF0000:"90  100%\n":STACK \
COMMENT:"CIRCUIT SPEED\: 100000000 bits per second\n" \
COMMENT:"INBOUND TRAFFIC RATE" \
GPRINT:cdefbe:AVERAGE:" Avg\:%8.2lf %s" \
GPRINT:cdefbe:MIN:"Min\:%8.2lf %s" \
GPRINT:cdefbe:MAX:"Max\:%8.2lf %s" \
GPRINT:cdefbe:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"INBOUND TRAFFIC %" \
GPRINT:cdefa:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefa:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefa:MAX:"Max\:(%5.2lf %%)" \
GPRINT:cdefa:LAST:"Current\:(%5.2lf %%)\n" \
COMMENT:"OUTBOUND TRAFFIC RATE" \
GPRINT:cdefce:AVERAGE:"Avg\:%8.2lf %s" \
GPRINT:cdefce:MIN:"Min\:%8.2lf %s" \
GPRINT:cdefce:MAX:"Max\:%8.2lf %s" \
GPRINT:cdefce:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"OUTBOUND TRAFFIC %" \
GPRINT:cdefb:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefb:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefb:MAX:"Max\:(%5.2lf %%)" \
GPRINT:cdefb:LAST:"Current\:(%5.2lf %%)\n" \
COMMENT:"TOTAL DATA MOVED" \
COMMENT:" Inbound\: 0 bytes" \
COMMENT:"Outbound\: 0 bytes"
/usr/local/bin/rrdtool graph  \
imgformat=PNG \
start=86400 \
end=300 \
title="Circuit Utilization  Summary  FastEthernet0/1" \
base=1000 \
height=120 \
width=500 \
altautoscalemax \
lowerlimit=0 \
verticallabel="Percent" \
slopemode \
DEF:a="/usr/local/www/*********/webfiles/rra/pgabcr1_20ws2950_traffic_in_1590.rrd":traffic_in:LAST \
DEF:b="/usr/local/www/*********/webfiles/rra/pgabcr1_20ws2950_traffic_in_1590.rrd":traffic_out:LAST \
CDEF:cdefa=a,100000000,/,100,*,8,* \
CDEF:cdefb=b,100000000,/,100,*,8,* \
CDEF:cdefc=a,b,+,100000000,/,100,*,8,*,10,LE,a,b,+,100000000,/,100,*,8,*,0,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,b,+,100000000,/,100,*,8,*,30,LE,a,b,+,100000000,/,100,*,8,*,20,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,b,+,100000000,/,100,*,8,*,50,LE,a,b,+,100000000,/,100,*,8,*,40,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,b,+,100000000,/,100,*,8,*,70,LE,a,b,+,100000000,/,100,*,8,*,60,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,b,+,100000000,/,100,*,8,*,90,LE,a,b,+,100000000,/,100,*,8,*,80,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,b,+,100000000,/,100,*,8,*,20,LE,a,b,+,100000000,/,100,*,8,*,10,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,b,+,100000000,/,100,*,8,*,40,LE,a,b,+,100000000,/,100,*,8,*,30,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,b,+,100000000,/,100,*,8,*,60,LE,a,b,+,100000000,/,100,*,8,*,50,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,b,+,100000000,/,100,*,8,*,80,LE,a,b,+,100000000,/,100,*,8,*,70,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,b,+,100000000,/,100,*,8,*,5000,LE,a,b,+,100000000,/,100,*,8,*,90,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbe=a,8,* \
CDEF:cdefce=b,8,* \
\
\
:cdefc#3ACE0C:" 0  10%":STACK \
:cdefd#99FF99:"20  30%":STACK \
:cdefe#ffff00:"40  50%":STACK \
:cdeff#FF8C1A:"60  70%":STACK \
:cdefg#FF3333:"80  90%\n":STACK \
:cdefh#00FF00:"10  20%":STACK \
:cdefi#FFFF80:"30  40%":STACK \
:cdefj#FFA54C:"50  60%":STACK \
:cdefba#FF5F00:"70  80%":STACK \
:cdefbb#FF0000:"90  100%\n":STACK \
COMMENT:"CIRCUIT SPEED\: 100000000 bits per second\n" \
COMMENT:"INBOUND TRAFFIC RATE" \
GPRINT:cdefbe:AVERAGE:" Avg\:%8.2lf %s" \
GPRINT:cdefbe:MIN:"Min\:%8.2lf %s" \
GPRINT:cdefbe:MAX:"Max\:%8.2lf %s" \
GPRINT:cdefbe:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"INBOUND TRAFFIC %" \
GPRINT:cdefa:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefa:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefa:MAX:"Max\:(%5.2lf %%)" \
GPRINT:cdefa:LAST:"Current\:(%5.2lf %%)\n" \
COMMENT:"OUTBOUND TRAFFIC RATE" \
GPRINT:cdefce:AVERAGE:"Avg\:%8.2lf %s" \
GPRINT:cdefce:MIN:"Min\:%8.2lf %s" \
GPRINT:cdefce:MAX:"Max\:%8.2lf %s" \
GPRINT:cdefce:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"OUTBOUND TRAFFIC %" \
GPRINT:cdefb:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefb:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefb:MAX:"Max\:(%5.2lf %%)" \
GPRINT:cdefb:LAST:"Current\:(%5.2lf %%)\n" \
COMMENT:"TOTAL DATA MOVED" \
COMMENT:" Inbound\: 0 bytes" \
COMMENT:"Outbound\: 0 bytes"
 Attachments

 untitled.JPG (82 KiB) Viewed 11597 times
 TheWitness
 Developer
 Posts: 14817
 Joined: Tue May 14, 2002 5:08 pm
 Location: MI, USA
 Contact:
You will still see the 2 new lines when you display the graph syntax, however, the rrdtool_execute function should be removing them. In addition, all RRDNL's are removed from the file prior to calling rrdtool in the rrdtool_ececute function.
Therefore, I am concerned that this is not the issue.
TheWitness
Therefore, I am concerned that this is not the issue.
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
 TheWitness
 Developer
 Posts: 14817
 Joined: Tue May 14, 2002 5:08 pm
 Location: MI, USA
 Contact:
Allen K,
I see a syntax error. I will have to research.
TheWitness
I see a syntax error. I will have to research.
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
 TheWitness
 Developer
 Posts: 14817
 Joined: Tue May 14, 2002 5:08 pm
 Location: MI, USA
 Contact:
Ok, here is the issue. The following:
TheWitness
Is not a valid syntax for RRDTool 1.2.x. It should be more like:\
\
:cdefc#3ACE0C:" 0  10%":STACK \
:cdefd#99FF99:"20  30%":STACK \
:cdefe#ffff00:"40  50%":STACK \
:cdeff#FF8C1A:"60  70%":STACK \
:cdefg#FF3333:"80  90%\n":STACK \
:cdefh#00FF00:"10  20%":STACK \
:cdefi#FFFF80:"30  40%":STACK \
:cdefj#FFA54C:"50  60%":STACK \
:cdefba#FF5F00:"70  80%":STACK \
:cdefbb#FF0000:"90  100%\n":STACK \
So, what we have here is either a damaged template or something else whacky in addition to a potentially buggy lib/rrd.php function.AREA????? \
AREA????? \
AREA:cdefc#3ACE0C:" 0  10%":STACK \
AREA:cdefd#99FF99:"20  30%":STACK \
AREA:cdefe#ffff00:"40  50%":STACK \
AREA:cdeff#FF8C1A:"60  70%":STACK \
AREA:cdefg#FF3333:"80  90%\n":STACK \
AREA:cdefh#00FF00:"10  20%":STACK \
AREA:cdefi#FFFF80:"30  40%":STACK \
AREA:cdefj#FFA54C:"50  60%":STACK \
AREA:cdefba#FF5F00:"70  80%":STACK \
AREA:cdefbb#FF0000:"90  100%\n":STACK \
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
 gandalf
 Developer
 Posts: 22375
 Joined: Thu Dec 02, 2004 2:46 am
 Location: Muenster, Germany
 Contact:
TheWitness,
well, but it's not only the backslash item. Sorry for leading you into the wrong direction, but please have a look at those weird AREA: :STACK statements
Reinhard
[edit]
Sorry, did not see TheWitness' last post. So we do agree about the AREA. If AREA/LINE are allowed with color=NONE, you will get that item. If you'd like to have a look at my bug report; I suppose it would be a little mod of some ifstatement in the graphing function of rrd.php to get rid of this ...
[/edit]
well, but it's not only the backslash item. Sorry for leading you into the wrong direction, but please have a look at those weird AREA: :STACK statements
You see, AREA is missing ...Allen K wrote: CDEF:cdefbe=a,8,* \
CDEF:cdefce=b,8,* \
\
\
:cdefc#3ACE0C:" 0  10%":STACK \
:cdefd#99FF99:"20  30%":STACK \
Reinhard
[edit]
Sorry, did not see TheWitness' last post. So we do agree about the AREA. If AREA/LINE are allowed with color=NONE, you will get that item. If you'd like to have a look at my bug report; I suppose it would be a little mod of some ifstatement in the graphing function of rrd.php to get rid of this ...
[/edit]
 TheWitness
 Developer
 Posts: 14817
 Joined: Tue May 14, 2002 5:08 pm
 Location: MI, USA
 Contact:
I have left an email for roman to resolve the application of the patch. There is quite a bit of work being performed to rrd.php at the moment.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
Life is an adventure, let yours begin with Cacti!
Author of MacTrack, Boost, CLog, SpikeKill, Platform RTM, DSStats, maintainer of Spine, lot's of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Central Plugin Repository
Central Templates Repository
I'm still out there people. Getting excited for Cacti 1.2. I think it will be a great release.
The graph that I posted earlier in this thread is displayed using rrdtool 1.0.x on my server but I do have an Area command at the start of my line. I believe that the Area or Line is prefix by the Associated Graph Item under the Graph Item Inputs in the Graph Templates.
For completeness I have included a copy of the graph properties for the graph that I posted earlier.
/usr/bin/rrdtool graph  \
imgformat=GIF \
start=86400 \
end=300 \
title="Internet Router  Circuit Utilisation  ATM1/0.1aal5 l" \
base=1000 \
height=240 \
width=500 \
altautoscalemax \
lowerlimit=100 \
verticallabel="Outbound (bits/sec) Inbound" \
DEF:a="/www/htdocs/cacti/rra/internet_router_2_traffic_out_1871.rrd":traffic_in:LAST \
DEF:b="/www/htdocs/cacti/rra/internet_router_2_traffic_out_1871.rrd":traffic_out:LAST \
CDEF:cdefa=a,8,* \
CDEF:cdefc=a,6900000,/,100,*,8,*,10,LE,a,6900000,/,100,*,8,*,0,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,6900000,/,100,*,8,*,20,LE,a,6900000,/,100,*,8,*,10,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,6900000,/,100,*,8,*,30,LE,a,6900000,/,100,*,8,*,20,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,6900000,/,100,*,8,*,40,LE,a,6900000,/,100,*,8,*,30,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,6900000,/,100,*,8,*,50,LE,a,6900000,/,100,*,8,*,40,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,6900000,/,100,*,8,*,60,LE,a,6900000,/,100,*,8,*,50,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,6900000,/,100,*,8,*,70,LE,a,6900000,/,100,*,8,*,60,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,6900000,/,100,*,8,*,80,LE,a,6900000,/,100,*,8,*,70,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,6900000,/,100,*,8,*,90,LE,a,6900000,/,100,*,8,*,80,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,6900000,/,100,*,8,*,5000,LE,a,6900000,/,100,*,8,*,90,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbc=b,8,*,1,* \
CDEF:cdefbe=b,6900000,/,100,*,8,*,10,LE,b,6900000,/,100,*,8,*,0,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbf=b,6900000,/,100,*,8,*,20,LE,b,6900000,/,100,*,8,*,10,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbg=b,6900000,/,100,*,8,*,30,LE,b,6900000,/,100,*,8,*,20,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbh=b,6900000,/,100,*,8,*,40,LE,b,6900000,/,100,*,8,*,30,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbi=b,6900000,/,100,*,8,*,50,LE,b,6900000,/,100,*,8,*,40,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbj=b,6900000,/,100,*,8,*,60,LE,b,6900000,/,100,*,8,*,50,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefca=b,6900000,/,100,*,8,*,70,LE,b,6900000,/,100,*,8,*,60,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcb=b,6900000,/,100,*,8,*,80,LE,b,6900000,/,100,*,8,*,70,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcc=b,6900000,/,100,*,8,*,90,LE,b,6900000,/,100,*,8,*,80,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcd=b,6900000,/,100,*,8,*,5000,LE,b,6900000,/,100,*,8,*,90,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
LINE1:cdefa#C0C0C0:"" \
COMMENT:"Inbound:" \
AREA:cdefc#35962B:"010%" \
AREA:cdefd#6EA100:"1020%" \
AREA:cdefe#00CF00:"2030%" \
AREA:cdeff#FAFD9E:"3040%" \
AREA:cdefg#F5F800:"4050%" \
AREA:cdefh#EAAF00:"5060%" \
AREA:cdefi#EA8F00:"6070%" \
AREA:cdefj#FF7D00:"7080%" \
AREA:cdefba#DE0056:"8090%" \
AREA:cdefbb#FF0000:"90100%\n" \
LINE1:cdefbc#C0C0C0:"" \
COMMENT:"Outbound:" \
AREA:cdefbe#35962B:"010%" \
AREA:cdefbf#6EA100:"1020%" \
AREA:cdefbg#00CF00:"2030%" \
AREA:cdefbh#FAFD9E:"3040%" \
AREA:cdefbi#F5F800:"4050%" \
AREA:cdefbj#EAAF00:"5060%" \
AREA:cdefca#EA8F00:"6070%" \
AREA:cdefcb#FF7D00:"7080%" \
AREA:cdefcc#DE0056:"8090%" \
AREA:cdefcd#FF0000:"90100%"
For completeness I have included a copy of the graph properties for the graph that I posted earlier.
/usr/bin/rrdtool graph  \
imgformat=GIF \
start=86400 \
end=300 \
title="Internet Router  Circuit Utilisation  ATM1/0.1aal5 l" \
base=1000 \
height=240 \
width=500 \
altautoscalemax \
lowerlimit=100 \
verticallabel="Outbound (bits/sec) Inbound" \
DEF:a="/www/htdocs/cacti/rra/internet_router_2_traffic_out_1871.rrd":traffic_in:LAST \
DEF:b="/www/htdocs/cacti/rra/internet_router_2_traffic_out_1871.rrd":traffic_out:LAST \
CDEF:cdefa=a,8,* \
CDEF:cdefc=a,6900000,/,100,*,8,*,10,LE,a,6900000,/,100,*,8,*,0,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,6900000,/,100,*,8,*,20,LE,a,6900000,/,100,*,8,*,10,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,6900000,/,100,*,8,*,30,LE,a,6900000,/,100,*,8,*,20,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,6900000,/,100,*,8,*,40,LE,a,6900000,/,100,*,8,*,30,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,6900000,/,100,*,8,*,50,LE,a,6900000,/,100,*,8,*,40,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,6900000,/,100,*,8,*,60,LE,a,6900000,/,100,*,8,*,50,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,6900000,/,100,*,8,*,70,LE,a,6900000,/,100,*,8,*,60,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,6900000,/,100,*,8,*,80,LE,a,6900000,/,100,*,8,*,70,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,6900000,/,100,*,8,*,90,LE,a,6900000,/,100,*,8,*,80,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,6900000,/,100,*,8,*,5000,LE,a,6900000,/,100,*,8,*,90,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbc=b,8,*,1,* \
CDEF:cdefbe=b,6900000,/,100,*,8,*,10,LE,b,6900000,/,100,*,8,*,0,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbf=b,6900000,/,100,*,8,*,20,LE,b,6900000,/,100,*,8,*,10,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbg=b,6900000,/,100,*,8,*,30,LE,b,6900000,/,100,*,8,*,20,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbh=b,6900000,/,100,*,8,*,40,LE,b,6900000,/,100,*,8,*,30,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbi=b,6900000,/,100,*,8,*,50,LE,b,6900000,/,100,*,8,*,40,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbj=b,6900000,/,100,*,8,*,60,LE,b,6900000,/,100,*,8,*,50,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefca=b,6900000,/,100,*,8,*,70,LE,b,6900000,/,100,*,8,*,60,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcb=b,6900000,/,100,*,8,*,80,LE,b,6900000,/,100,*,8,*,70,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcc=b,6900000,/,100,*,8,*,90,LE,b,6900000,/,100,*,8,*,80,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcd=b,6900000,/,100,*,8,*,5000,LE,b,6900000,/,100,*,8,*,90,GT,b,8,*,1,*,UNKN,IF,UNKN,IF \
LINE1:cdefa#C0C0C0:"" \
COMMENT:"Inbound:" \
AREA:cdefc#35962B:"010%" \
AREA:cdefd#6EA100:"1020%" \
AREA:cdefe#00CF00:"2030%" \
AREA:cdeff#FAFD9E:"3040%" \
AREA:cdefg#F5F800:"4050%" \
AREA:cdefh#EAAF00:"5060%" \
AREA:cdefi#EA8F00:"6070%" \
AREA:cdefj#FF7D00:"7080%" \
AREA:cdefba#DE0056:"8090%" \
AREA:cdefbb#FF0000:"90100%\n" \
LINE1:cdefbc#C0C0C0:"" \
COMMENT:"Outbound:" \
AREA:cdefbe#35962B:"010%" \
AREA:cdefbf#6EA100:"1020%" \
AREA:cdefbg#00CF00:"2030%" \
AREA:cdefbh#FAFD9E:"3040%" \
AREA:cdefbi#F5F800:"4050%" \
AREA:cdefbj#EAAF00:"5060%" \
AREA:cdefca#EA8F00:"6070%" \
AREA:cdefcb#FF7D00:"7080%" \
AREA:cdefcc#DE0056:"8090%" \
AREA:cdefcd#FF0000:"90100%"
Steve
Please have a look at the rrdtool graph statements (select the wrench ...). If it occurs to be the same strange thing as above (2 lines containing a backslash only), then the answer is: yes. There's a solution (I've posted a bug report and appended a patch, see http://bugs.cacti.net/view.php?id=585).
Reinhard
I have applied this patch to my installation and everything is working correct now.
CDEF:cdefi=a,b,+,100000000,/,100,*,8,*,40,LE,a,b,+,100000000,/,100,*,8,*,30,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,b,+,100000000,/,100,*,8,*,60,LE,a,b,+,100000000,/,100,*,8,*,50,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,b,+,100000000,/,100,*,8,*,80,LE,a,b,+,100000000,/,100,*,8,*,70,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,b,+,100000000,/,100,*,8,*,5000,LE,a,b,+,100000000,/,100,*,8,*,90,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbe=a,8,* \
CDEF:cdefce=bb,8,* \
AREA:cdefa:"" \
AREA:cdefb:"":STACK \
AREA:cdefc#3ACE0C:" 0  10%":STACK \
AREA:cdefd#99FF99:"20  30%":STACK \
Spoke too soon, graph is now showing same percent in/out for the link... hrmmm
 Attachments

 graph_image.php.png (35.52 KiB) Viewed 11508 times
To reply to cjennings_cr post there are a number of explanations on CDEFs on the net but it still took me a awhile to understand how they work. CDEFs use reverse polish notation to calculate there answers and uses a stack to process variables, numbers and operations. I will try and explain the basic CDEF and one of the ones used in my graph posted before.
Note that by putting together this info document I have discovered a problem with my previously posted CDEFs which I will repost.
I hasten to add that I am no CDEF expert and what I am posting is mainly found by research and a lot of trial and error.
Simple form:
In Cacti there are a number of ways to identify variables that are used in the graph the following two examples would produce the same result if there was only one data source, Where “CURRENT_DATA_SOURCE” and “a” are the same variable. Take the graph that I posted earlier in this thread this uses two data sources and I have elected to call the “a” and “b” as per jas0420 original post. These relate to Data Source [traffic_in] and Data Source [traffic_out] in this example, if you have four Data Sources then you could have variables a,b,c,d for instance. The variable letter is relative to the order of the data sources are ordered in the graph template.
CURRENT_DATA_SOURCE,8,*
or
a,8,*
The above calculation converts bytes into bits. Variable “a” is the value obtained by the poll of the device from Cacti for our example here we will give “a” a value of 32 KBytes, therefore:
a,8,* will equate to 32000,8,* this can be turned into 32000 * 8 which equals 256000 bits.
so 32000 is placed on the stack and then 8 is placed on the stack then an multiple is places on the stack, all three entireties are replaced by 256000, CDEFs must only return one value if not you will get a lot of warnings about invalid CDEFs and your graphs will not display.
Now lets try something a bit more challenging, this is for the positive side of the graph where the value is between 0 and 10% of the interfaces throughput.
a,8,*,query_ifSpeed,/,100,*,10,LE,a,8,*,query_ifSpeed,/,100,*,0,GT,a,8,*,UNKN,IF,UNKN,IF
Here we have a number of variables:
“a” which is the number of bytes at the time of the sample.
“query_ifSpeed” which is the value defined by the Bandwidth statement on a Cisco in this example, this value could be replaced with the maximum bandwidth of the interface. This value is defined in bits.
The stack is empty and then we put the following in:
a,8,* this will convert the bytes into bits 32000,8,* and is equal to 256000
the stack now contains 256000 and the next part of the CDEF is placed on the stack
256000,query_ifSpeed,/, this would be 256000,6900000,/ and equal 0.037101449275362318840579710144928
Our internet link is 6900 Kbits as defined on the router and is listed as 6900000 in Cacti interface speed on the devices page.
The stack now contains the number 0.037101449275362318840579710144928
To this we add 100 and then a multiply operation
0.037101449275362318840579710144928,100,/ and is equal to 3.7101449275362318840579710144928.
The stack now contains 3.7101449275362318840579710144928
We then push 10 to the stack and the LE operation (Less than or equal to).
3.7101449275362318840579710144928,10,LE
“LE” compares the first value to the second and if it is true returns 1, false returns 0, in this case 3.7101449275362318840579710144928 is less than 10 so 1 is placed on the stack.
1
Now we check to see if the a,8,*,query_ifSpeed,/,100,* is grater than zero.
The calculation needs to be done again as the only value on the stack is 1 at the moment so after the above calculation we have the following in the stack:
1, 3.7101449275362318840579710144928
We now add 0 and do the comparison so the stack looks like this:
1, 3.7101449275362318840579710144928,0,GT
GT will pop 3.7101449275362318840579710144928 and 0 from the stack and as 3.7101449275362318840579710144928 is greater than zero it will place 1 on the stack.
The stack is now contains
1,1
now we will add the following calculation to the stack
a,8,*
This will add 32000,8 and the multiply variable to the stack:
1,1,32000,8,*
the multiple operator will take 32000 and 8 from the stack and return 256000 so the following this the stack contains
1,1,256000
Now we are moving into the IF function of the CDEF the next two items added to the stack are:
UNKN,IF
UNKN is a function to represent an unknown number.
So the stack looks like this
1,1,256000, UNKN,IF
The IF function pops three values from the stack in this case:
1,256000,UNKN
the IF function looks at the left hand most function and if it is 0 it will return the middle value or if it is 1 then it will return the right most value. So in our case it returns 256000 as the left hand variable is 1.
The stack now looks like this
1,256000
The second “IF” statement is now executed so the stack looks like this
1,256000, UNKN,IF
Here again the 1 indicates that the IF statement is true, therefore the result of the CDEF is
256000 and this is what is plotted as an area on the graph.
If the answer had been 0 then UNKN would be returned, UNKN can not be graphed.
NEGINF and INF define infinity in the graph and is used to plot a area from a point to the upper, INF, or lower, NEGINF, border of the graph and hence why you can not use it in a graph that uses both positive and negative values as the would overwrite each other.
I hope this help with your understanding of CDEFs and lets you explore there potential a bit more.
Note that by putting together this info document I have discovered a problem with my previously posted CDEFs which I will repost.
I hasten to add that I am no CDEF expert and what I am posting is mainly found by research and a lot of trial and error.
Simple form:
In Cacti there are a number of ways to identify variables that are used in the graph the following two examples would produce the same result if there was only one data source, Where “CURRENT_DATA_SOURCE” and “a” are the same variable. Take the graph that I posted earlier in this thread this uses two data sources and I have elected to call the “a” and “b” as per jas0420 original post. These relate to Data Source [traffic_in] and Data Source [traffic_out] in this example, if you have four Data Sources then you could have variables a,b,c,d for instance. The variable letter is relative to the order of the data sources are ordered in the graph template.
CURRENT_DATA_SOURCE,8,*
or
a,8,*
The above calculation converts bytes into bits. Variable “a” is the value obtained by the poll of the device from Cacti for our example here we will give “a” a value of 32 KBytes, therefore:
a,8,* will equate to 32000,8,* this can be turned into 32000 * 8 which equals 256000 bits.
so 32000 is placed on the stack and then 8 is placed on the stack then an multiple is places on the stack, all three entireties are replaced by 256000, CDEFs must only return one value if not you will get a lot of warnings about invalid CDEFs and your graphs will not display.
Now lets try something a bit more challenging, this is for the positive side of the graph where the value is between 0 and 10% of the interfaces throughput.
a,8,*,query_ifSpeed,/,100,*,10,LE,a,8,*,query_ifSpeed,/,100,*,0,GT,a,8,*,UNKN,IF,UNKN,IF
Here we have a number of variables:
“a” which is the number of bytes at the time of the sample.
“query_ifSpeed” which is the value defined by the Bandwidth statement on a Cisco in this example, this value could be replaced with the maximum bandwidth of the interface. This value is defined in bits.
The stack is empty and then we put the following in:
a,8,* this will convert the bytes into bits 32000,8,* and is equal to 256000
the stack now contains 256000 and the next part of the CDEF is placed on the stack
256000,query_ifSpeed,/, this would be 256000,6900000,/ and equal 0.037101449275362318840579710144928
Our internet link is 6900 Kbits as defined on the router and is listed as 6900000 in Cacti interface speed on the devices page.
The stack now contains the number 0.037101449275362318840579710144928
To this we add 100 and then a multiply operation
0.037101449275362318840579710144928,100,/ and is equal to 3.7101449275362318840579710144928.
The stack now contains 3.7101449275362318840579710144928
We then push 10 to the stack and the LE operation (Less than or equal to).
3.7101449275362318840579710144928,10,LE
“LE” compares the first value to the second and if it is true returns 1, false returns 0, in this case 3.7101449275362318840579710144928 is less than 10 so 1 is placed on the stack.
1
Now we check to see if the a,8,*,query_ifSpeed,/,100,* is grater than zero.
The calculation needs to be done again as the only value on the stack is 1 at the moment so after the above calculation we have the following in the stack:
1, 3.7101449275362318840579710144928
We now add 0 and do the comparison so the stack looks like this:
1, 3.7101449275362318840579710144928,0,GT
GT will pop 3.7101449275362318840579710144928 and 0 from the stack and as 3.7101449275362318840579710144928 is greater than zero it will place 1 on the stack.
The stack is now contains
1,1
now we will add the following calculation to the stack
a,8,*
This will add 32000,8 and the multiply variable to the stack:
1,1,32000,8,*
the multiple operator will take 32000 and 8 from the stack and return 256000 so the following this the stack contains
1,1,256000
Now we are moving into the IF function of the CDEF the next two items added to the stack are:
UNKN,IF
UNKN is a function to represent an unknown number.
So the stack looks like this
1,1,256000, UNKN,IF
The IF function pops three values from the stack in this case:
1,256000,UNKN
the IF function looks at the left hand most function and if it is 0 it will return the middle value or if it is 1 then it will return the right most value. So in our case it returns 256000 as the left hand variable is 1.
The stack now looks like this
1,256000
The second “IF” statement is now executed so the stack looks like this
1,256000, UNKN,IF
Here again the 1 indicates that the IF statement is true, therefore the result of the CDEF is
256000 and this is what is plotted as an area on the graph.
If the answer had been 0 then UNKN would be returned, UNKN can not be graphed.
NEGINF and INF define infinity in the graph and is used to plot a area from a point to the upper, INF, or lower, NEGINF, border of the graph and hence why you can not use it in a graph that uses both positive and negative values as the would overwrite each other.
I hope this help with your understanding of CDEFs and lets you explore there potential a bit more.
Steve