[HOWTO] Color coded percent utilization

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
jonyhawk
Posts: 3
Joined: Thu Jan 18, 2007 8:22 am

Manual connexion speed

Post by jonyhawk »

Hi,

I have realize all the procedures to create graph with colours utilisation pourcentage. I have transform the graph template for having Inbound and Outbound traffic on 2 seperate graph. But I have a question on the circuit speed take by snmp. I have a network cart which is configure in 100Mbits but my connexion isn't at 100M but at 12M. I have some link like that but with several speed.

I want to know if is it possible to ask to users to put manualy the connexion speed
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi Jony

You can't do this with Cacti, unless someone has written a script/addon. You will need to adjust the circuit speed on the device itself to the correct speed.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
romanmir
Posts: 4
Joined: Wed May 31, 2006 6:07 pm
Contact:

Post by romanmir »

Here is the debug of my graph:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Circuit Utilization - Summary - |query_ifDescr|" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percent" \
--slope-mode \
DEF:a="/usr/share/cacti/site/rra/router_gateway_traffic_in_46.rrd":traffic_in:LAST \
DEF:b="/usr/share/cacti/site/rra/router_gateway_traffic_in_46.rrd":traffic_out:LAST \
CDEF:cdefa=a,,/,100,*,8,* \
CDEF:cdefb=b,,/,100,*,8,* \
CDEF:cdefc=a,b,+,,/,100,*,8,*,10,LE,a,b,+,,/,100,*,8,*,0,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,b,+,,/,100,*,8,*,30,LE,a,b,+,,/,100,*,8,*,20,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,b,+,,/,100,*,8,*,50,LE,a,b,+,,/,100,*,8,*,40,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,b,+,,/,100,*,8,*,70,LE,a,b,+,,/,100,*,8,*,60,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,b,+,,/,100,*,8,*,90,LE,a,b,+,,/,100,*,8,*,80,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,b,+,,/,100,*,8,*,20,LE,a,b,+,,/,100,*,8,*,10,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,b,+,,/,100,*,8,*,40,LE,a,b,+,,/,100,*,8,*,30,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,b,+,,/,100,*,8,*,60,LE,a,b,+,,/,100,*,8,*,50,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,b,+,,/,100,*,8,*,80,LE,a,b,+,,/,100,*,8,*,70,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,b,+,,/,100,*,8,*,5000,LE,a,b,+,,/,100,*,8,*,90,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbe=a,8,* \
CDEF:cdefce=b,8,* \
AREA:cdefa:""  \
AREA:cdefb:"":STACK \
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 \
COMMENT:"CIRCUIT SPEED\:         |query_ifSpeed| 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" 

RRDTool Says:

ERROR: invalid rpn expression in: a,,/,100,*,8,*
ok, obviously I'm missing a step somewhere. I am trying to use this against a wrt54g router that has been loaded with dd-wrt.

When I go to add this graph to the host, it fills in the traffic_in and traffic_out fields for me. I do NOT fill anything in on the "Custom Data" section, as I'm not sure what it is asking for or if it is even relevant.

I am using cacti 0.8.6h on a Ubuntu Edgy (6.10) box. I have also applied the patches specified in this post: http://forums.cacti.net/viewtopic.php?t=3030

What am I missing?
jlscott
Posts: 8
Joined: Wed Jan 19, 2005 11:07 am

Post by jlscott »

I've got this working, however a few of the links I'm monitoring are gigabit or higher. I've amended the data source min/max values to 1000000000 however the graph is showing values of 100-1000m percent. Is there a way to correct this please?

Image
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

You would need to use 64bit counters for GIG interfaces. The template isn't set up to use 64 bit counters. Having had a look at my cacti you would have to set up a new data template for ifHCInoctets and ifHCOutoctets. You would then need to point your graph template at the 64bit counter data sources rather than then normal ifINOctets etc.

I tend to only use this template for WAN links of which we don't have any over 100M so this isn't an issue for me. I use the standard 64bit vounter graphs for anything over 1G.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
jlscott
Posts: 8
Joined: Wed Jan 19, 2005 11:07 am

Post by jlscott »

Ah, thanks Jay.
jlscott
Posts: 8
Joined: Wed Jan 19, 2005 11:07 am

Post by jlscott »

Sorry, something else I'm also getting but only with these graphs are slight gaps. However when you zoom in the gaps are more single pixel borders between changes in colour. Is that something anyone else sees?
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Hi

Please post a screenshot.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
Spingo
Posts: 4
Joined: Thu Oct 19, 2006 7:18 pm

Post by Spingo »

I have the issue with little gaps appearing too. I actually searched this thread to see if anyone else has resolved this issue. I have attached a sample graph (the bottom graph below). While my graph doesn't exactly use the code and CDEFs used in this thread, my custom CDEFs are based heavily on the information in this thread.

I actually think that RRDTool 1.2 is causing this - one of the new "features" included in v1.2 is anti-aliased output. This means that the typical "Manhattan" style graphs are no longer done and there are gradients occuring between the values. Allow me to draw a textual representation (and admin my piss-poor ASCII art skills):

----------\ /---------
Colour 1\ /Colour 2

Erm.. You get the idea..

I don't know if it's possible to stop RRDTool from rendering these particular graphs in an anti-aliased manner or not. In any case, there's definately no way to instruct Cacti to tell RRDTool not to do so as far as I'm aware.

Possible new feature request, if it's do-able?

:: edit ::

And now that I've got off my butt and looked into the RRDTool documentation some more, I see the following line in the Graph Debug:
--slope-mode \
The RRDTool docs have the following to say about this argument:
[-E|--slope-mode]

RRDtool graphs are composed of stair case curves by default. This is in line with the way RRDtool calculates its data. Some people favor a more 'organic' look for their graphs even though it is not all that true.
I believe that when we tell cacti that we are using RRDTool 1.2, it automagically enables slope mode which causes the slight gaps in the graphs.

So, there's definately a case for a feature request for cacti - the ability to disable slope mode on a per graph basis (I personally love slope mode for my other graphs - it's just not suitable for this one).

:: second edit ::

And if you go to Console > Settings and change the RRDTool version to v1.0, the problem goes away - although you have more "blocky" graphs. The top graph is with the version set as 1.0 (even tough 1.2 is installed on my system)

:: third edit ::

One last note, I have just noticed that when I switch the version to 1.0, none of the graphs in the graph view are displayed - yet they can be displayed under Graph Management... So obviously, changing the version number as I mentioned in my last edit is useful for debugging this, but you shouldn't make the setting permanent. If you have RRDTool v1.2.x installed, keep the proper setting.
Attachments
With the RRDTool version within Cacti set to v1.0 instead of v1.2. No gaps, but a much blockier looking chart.
With the RRDTool version within Cacti set to v1.0 instead of v1.2. No gaps, but a much blockier looking chart.
graph_image2.png (53.15 KiB) Viewed 14767 times
Note the gaps between the blocks where the colour changes...
Note the gaps between the blocks where the colour changes...
graph_image.png (60.43 KiB) Viewed 14774 times
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Interesting. I have just checked mine and I see the same gaps when the colour changes. Never noticed it before. :oops:

Maybe the developers can comment on this??

edit!!!!

I see you have added this as a feature request -

http://forums.cacti.net/viewtopic.php?p ... ght=#95097
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
jarhead
Cacti User
Posts: 59
Joined: Tue Nov 22, 2005 2:24 pm
Location: Portland, Or

Post by jarhead »

I am attempting to get this to work for me also. I have all the positive and negative cdef's created, but when I attempt to create a graph, I it never graphed. The output is as follows

Code: Select all


/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Circuit Utilization" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percent" \
--slope-mode \
DEF:a="/usr/local/monitoring/cacti/rra/pdxentrte01_traffic_in_1150.rrd":traffic_in:LAST \
DEF:b="/usr/local/monitoring/cacti/rra/pdxentrte01_traffic_in_1150.rrd":traffic_out:LAST \
CDEF:cdefc=a,100000000,/,100,*,8,*,10,LE,a,100000000,/,100,*,8,*,0,GT,a,8,*,UNKN,IF,UNKN,IF  \
CDEF:cdefd=a,100000000,/,100,*,8,*,20,LE,a,100000000,/,100,*,8,*,10,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,100000000,/,100,*,8,*,30,LE,a,100000000,/,100,*,8,*,20,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,100000000,/,100,*,8,*,40,LE,a,100000000,/,100,*,8,*,30,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,100000000,/,100,*,8,*,50,LE,a,100000000,/,100,*,8,*,40,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,100000000,/,100,*,8,*,60,LE,a,100000000,/,100,*,8,*,50,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,100000000,/,100,*,8,*,70,LE,a,100000000,/,100,*,8,*,60,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,100000000,/,100,*,8,*,80,LE,a,100000000,/,100,*,8,*,70,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,100000000,/,100,*,8,*,90,LE,a,100000000,/,100,*,8,*,80,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,100000000,/,100,*,8,*,5000,LE,a,100000000,/,100,*,8,*,90,GT,a,8,*,UNKN,IF,UNKN,IF \
CDEF:cdefbe=b,100000000,/,100,*,8,*,10,LE,b,100000000,/,100,*,8,*,0,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbh=b,100000000,/,100,*,8,*,40,LE,b,100000000,/,100,*,8,*,30,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbi=b,100000000,/,100,*,8,*,50,LE,b,100000000,/,100,*,8,*,40,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefbj=b,100000000,/,100,*,8,*,60,LE,b,100000000,/,100,*,8,*,50,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefca=b,100000000,/,100,*,8,*,70,LE,b,100000000,/,100,*,8,*,60,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcb=b,100000000,/,100,*,8,*,80,LE,b,100000000,/,100,*,8,*,70,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
CDEF:cdefcd=b,100000000,/,100,*,8,*,5000,LE,b,100000000,/,100,*,8,*,90,GT,b,8,*,-1,*,UNKN,IF,UNKN,IF \
LINE1:a#C0C0C0:""  \
COMMENT:"Inbound\:"  \
AREA:cdefc#35962B:"0-10%"  \
AREA:cdefd#6EA100:"10-20%"  \
AREA:cdefe#00CF00:"20-30%"  \
AREA:cdeff#FAFD9E:"30-40%"  \
AREA:cdefg#F5F800:"40-50%"  \
AREA:cdefh#EAAF00:"50-60%"  \
AREA:cdefi#EA8F00:"60-70%"  \
AREA:cdefj#FF7D00:"70-80%"  \
AREA:cdefba#DE0056:"80-90%"  \
AREA:cdefbb#FF0000:"90-100%\n"  \
LINE1:b#C0C0C0:""  \
COMMENT:"Outbound\:"  \
AREA:cdefbe#35962B:"0-10%"  \
AREA:cdefd#6EA100:"10-20%"  \
AREA:#00CF00:"20-30%"  \
AREA:cdefbh#FAFD9E:"30-40%"  \
AREA:cdefbi#F5F800:"40-50%"  \
AREA:cdefbj#EAAF00:"50-60%"  \
AREA:cdefca#EA8F00:"60-70%"  \
AREA:cdefcb#FF7D00:"70-80%"  \
AREA:cdefba#DE0056:"80-90%"  \
AREA:cdefcd#FF0000:"90-100%\n" 
help me please......
scrapper777
Posts: 5
Joined: Mon Sep 24, 2007 9:21 am

Post by scrapper777 »

Hi,
I'm new to cacti. :cry: I can't seem to get the percentage to show up in my graph and am not sure why. Here is the graph debug and attached is my current graph.

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Interface - Traffic (bits/sec) percentage" \
--rigid \
--base=1000 \
--height=120 \
--width=600 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/mc3524n2_traffic_in_268.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/mc3524n2_traffic_in_268.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdefc=a,100000000,/,100,* \
CDEF:cdefh=b,8,* \
CDEF:cdefj=b,100000000,/,100,* \
AREA:cdefa#00CF00:"In" \
GPRINT:cdefa:LAST:" Current\:%7.2lf %s" \
GPRINT:cdefc:LAST:"(%3.2lf%%)" \
GPRINT:cdefa:AVERAGE:"Average\:%7.2lf %s" \
GPRINT:cdefc:AVERAGE:"(%3.2lf%%)" \
GPRINT:cdefa:MAX:"Maximum\:%7.2lf %s" \
GPRINT:cdefc:MAX:"(%3.2lf%%)\n" \
AREA:cdefh#002A97:"Out" \
GPRINT:cdefh:LAST:"Current\:%7.2lf %s" \
GPRINT:cdefj:LAST:"(%3.2lf%%)" \
GPRINT:cdefh:AVERAGE:"Average\:%7.2lf %s" \
GPRINT:cdefj:AVERAGE:"(%3.2lf%%)" \
GPRINT:cdefh:MAX:"Maximum\:%7.2lf %s" \
GPRINT:cdefj:MAX:"(%3.2lf%%)"
Attachments
myGraph.gif
myGraph.gif (13.63 KiB) Viewed 13924 times
jay
Cacti User
Posts: 390
Joined: Wed Aug 31, 2005 8:55 am
Location: Bristol, England

Post by jay »

Scrapper

I think this is due to the small amounts of data that are flowing via that link. I don't know they maths but the percentage will be worked out based on the amount of traffic flowing in and out and the speed of the link. You have less than 2K showing in your graph, what size is that link?? If its a 100M link then you won't see a percentage figure as the percentage is too small.

Hope this helps.

Jay
Cacti Version 0.8.7e, Spine 0.8.7e, Apache 2.2.15, Mysql 5.0.88, PHP 5.2.13, RRDTool 1.2.30, NET-SNMP 5.5
Quad Core AMD Opteron Processor 2384, 2.70Ghz, 2GB RAM , 1 CPU used
Windows Server 2003 (X64), VMWARE ESX
Plugins: Aggregate 0.75

SYSTEM STATS: Time:12.5140 Method:spine Processes:2 Threads:15 Hosts:400 HostsPerProcess:200 DataSources:2909 RRDsProcessed:1384
User avatar
neovox
Cacti User
Posts: 52
Joined: Tue Jan 02, 2007 8:22 am
Location: MI

Post by neovox »

FYI, you can turn off slope mode on the graph template to get rid of the gaps. In version 0.8.7 anyway.
laamidd
Posts: 48
Joined: Fri Feb 17, 2006 10:31 am

Post by laamidd »

Thanks Jason, this is exactly what I needed.

You made my week!

I'm using Version 0.8.6h of Cacti and if they haven't included your work here in the newer versions, they should.

Thanks again,
Bob
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests