[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
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Sorry, no windows here. On unix, I would recommend putting this into some file and executing this via

Code: Select all

sh filename
. For Debugging, please refer to my "NaN Debugging" howto linked in my signature
Reinhard
KMC
Posts: 10
Joined: Fri Oct 27, 2006 4:45 pm

Command Output

Post by KMC »

Below is the output from the command. I have also attached the stack dump it mentions creating in the command output.


22 [main] rrdtool 1176 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
4788 [main] rrdtool 1176 open_stackdumpfile: Dumping stack trace to rrdtool.exe.stackdump
112546 [main] rrdtool 1176 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
114602 [main] rrdtool 1176 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)
KMC
Posts: 10
Joined: Fri Oct 27, 2006 4:45 pm

Stack dump file

Post by KMC »

I don't think the stack dump was attached last time.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Whoops. I'm not the one that is able to debug stackdumps. You may post this to the windows forums
Reinhard
Last edited by gandalf on Mon Oct 30, 2006 11:03 am, edited 1 time in total.
KMC
Posts: 10
Joined: Fri Oct 27, 2006 4:45 pm

Post by KMC »

OK, Will do.
Dwayne_Dibbley
Cacti User
Posts: 52
Joined: Sun Sep 18, 2005 3:38 pm

Post by Dwayne_Dibbley »

Is it possible to graph as per the first post 0-100% on a positive only graph, but showing incoming and outcoming ie:

incoming 0-70% green, area, average
incoming 70-100% red, area, average

outcoming 0-70% blue, line1
outcoming 70-100% red, line1

so basicly the graph would look like the standard traffic graph, but in percent and not bits, and would turn red when over 70% used?

Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Of course. SImply change the numbers in the CDEFs accordingly
Reinhard
fosstob
Posts: 2
Joined: Wed Dec 13, 2006 5:44 pm
Location: Denver, Co
Contact:

Trouble with RRDTool command

Post by fosstob »

hi all, I have been trying to implement this graph.

i am running 8.6i-4 on a fedora 6 box

I am running into the exact issue on about the second page of this post where I am getting the two \\'s and then missing the area commands in front.

for example:
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" \
....
ERROR: Could not make sense out of ':cdefc#3ACE0C: 0 - 10%:STACK'




I know that the proposed patch was supposed to be fixed in 8.6h, but i thought I would try it anyway. All it did was totally kill my rrd all-together.


The patch resulted in:
AREA:cdefa:"" \
AREA:cdefb:"":STACK \
\
\
\
\
\
\
\
\
\
\
COMMENT:"CIRCUIT SPEED\: 100000000 bits per second\n" \
COMMENT:"INBOUND TRAFFIC RATE" \
...
ERROR: opening '/usr/share/cacti/rra/cs_sprint_1_traffic_in_198.rrd': No such file or directory

I must be totally missing something? Any suggestions would be apprciated.
thanks
fosstob
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Basically, the DEF statements are missing. As you did not show the whole statement, I cant't say more than this
Reinhard
fosstob
Posts: 2
Joined: Wed Dec 13, 2006 5:44 pm
Location: Denver, Co
Contact:

here is everything.

Post by fosstob »

My appologies, in the attempt to keep the post short and too the point, I made it even worse.

thanks again.
toby


RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Circuit Utilization Summary - Colorado Springs to Dublin \"B\" FastEthernet0/1 " \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percent" \
--slope-mode \
DEF:a="/usr/share/cacti/rra/cs_sprint_1_traffic_in_198.rrd":traffic_in:LAST \
DEF:b="/usr/share/cacti/rra/cs_sprint_1_traffic_in_198.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"
RRDTool Says:

ERROR: Could not make sense out of ':cdefc#3ACE0C: 0 - 10%:STACK'
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

That's a definitively broken template, that is. The very first graph item seems to be broken. But this is a guess
Reinhard
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

is it possible to use this cdefs with the default "Interface - Traffic (bits/sec)" graph template ? I only want to colorize the graphs... and dont want to see in the legend the percentage...
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may use CDEFs wherever you want. But if they denote "magic" DEF statements (that is DEF statement by letter!), this would be very special.
I recommend copying the "Usage" Graph Template. Create an example Graph from this copy. Then, delete the Legend items one by one and see, if it works. Add new Legends at wish. And you may change the LINE/AREA/STACK items not to graph the %usage but the "real" IN/OUT data by changing the data source they refer to.
Reinhard
rsaeks
Posts: 34
Joined: Mon Nov 06, 2006 5:15 pm

Post by rsaeks »

I am trying to use this template, and when I pin the graph to a host, I am not getting the data to appear. Turning on the graph debug mode shows this:

----/opt/local/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="/Library/WebServer/Documents/cacti/rra/maple_2621xm_traffic_in_456.rrd":traffic_in:LAST \
DEF:b="/Library/WebServer/Documents/cacti/rra/maple_2621xm_traffic_in_456.rrd":traffic_out:LAST \
DEF:c="/Library/WebServer/Documents/cacti/rra/maple_2621xm_traffic_in_456.rrd":traffic_in:AVERAGE \
DEF:d="/Library/WebServer/Documents/cacti/rra/maple_2621xm_traffic_in_456.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,|query_ifSpeed|,/,100,*,8,* \
CDEF:cdefb=b,|query_ifSpeed|,/,100,*,8,* \
CDEF:cdefc=a,b,+,|query_ifSpeed|,/,100,*,8,*,10,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,0,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefd=a,b,+,|query_ifSpeed|,/,100,*,8,*,30,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,20,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefe=a,b,+,|query_ifSpeed|,/,100,*,8,*,50,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,40,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdeff=a,b,+,|query_ifSpeed|,/,100,*,8,*,70,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,60,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefg=a,b,+,|query_ifSpeed|,/,100,*,8,*,90,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,80,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefh=a,b,+,|query_ifSpeed|,/,100,*,8,*,20,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,10,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefi=a,b,+,|query_ifSpeed|,/,100,*,8,*,40,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,30,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefj=a,b,+,|query_ifSpeed|,/,100,*,8,*,60,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,50,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefba=a,b,+,|query_ifSpeed|,/,100,*,8,*,80,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,70,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbb=a,b,+,|query_ifSpeed|,/,100,*,8,*,5000,LE,a,b,+,|query_ifSpeed|,/,100,*,8,*,90,GT,NEGINF,UNKN,IF,UNKN,IF \
CDEF:cdefbe=c,8,* \
CDEF:cdefbh=a,8,* \
CDEF:cdefbj=c,|query_ifSpeed|,/,100,*,8,* \
CDEF:cdefce=d,8,* \
CDEF:cdefch=b,8,* \
CDEF:cdefcj=d,|query_ifSpeed|,/,100,*,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:cdefbh:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"INBOUND TRAFFIC %" \
GPRINT:cdefbj:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefbj:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefbj: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:cdefch:LAST:"Current\:%8.2lf %s\n" \
COMMENT:"OUTBOUND TRAFFIC %" \
GPRINT:cdefcj:AVERAGE:" Avg\:(%5.2lf %%)" \
GPRINT:cdefcj:MIN:"Min\:(%5.2lf %%)" \
GPRINT:cdefcj: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:

sh: line 1: ,/,100,*,8,*: No such file or directory

----
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The CDEF breaks because the value for |query_ifSpeed| was not filled in correctly. This data is retrieved from each interface and stored in the poller_cache. If the device does not provide this data, your graph will fail. You may try to refresh this data by pressing the green circle next to the Data Query of that host ...
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests