[HOWTO] Graph errors/discard in percent ?
Moderators: Developers, Moderators
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
[HOWTO] Graph errors/discard in percent ?
I would like to modify the unit of discards/errors graph (from errors/sec to %). Is there a way to do this ?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Mais sure!
But you've got the need to get the "base" for that. AFAIK, discards and errors are measure as "packets/s", so the base must be measured in packets/s as well. For this, you'll have to retrieve unicast and non-unicast packets and sum them up.
That given, only the CDEF is missing: cdef=base,100,*,discards,/ (without having tried). Do you want to sum up discards and errors? Or do you need each of them seperately?
Reinhard
But you've got the need to get the "base" for that. AFAIK, discards and errors are measure as "packets/s", so the base must be measured in packets/s as well. For this, you'll have to retrieve unicast and non-unicast packets and sum them up.
That given, only the CDEF is missing: cdef=base,100,*,discards,/ (without having tried). Do you want to sum up discards and errors? Or do you need each of them seperately?
Reinhard
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
Could you detail the whole operations that i have to do ?
(i'm sure this will help everybody to make percent graphs)
I want to edit the current discard/errors graph.
So there are 4 lines :
Discards IN
Errors IN
Discards OUT
Errors OUT
So to make the percentage, i need to add the value of 'Total Packets' to my graph. How ?
And then, add a CDEF to make the math ?
How do you make it ?
(i'm sure this will help everybody to make percent graphs)
I want to edit the current discard/errors graph.
So there are 4 lines :
Discards IN
Errors IN
Discards OUT
Errors OUT
So to make the percentage, i need to add the value of 'Total Packets' to my graph. How ?
And then, add a CDEF to make the math ?
How do you make it ?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Let's begin.chewbacca156 wrote:Could you detail the whole operations that i have to do ?
(i'm sure this will help everybody to make percent graphs)
I want to edit the current discard/errors graph.
So there are 4 lines :
Discards IN
Errors IN
Discards OUT
Errors OUT
So to make the percentage, i need to add the value of 'Total Packets' to my graph. How ?
And then, add a CDEF to make the math ?
How do you make it ?
I recommend copying the current discard/errors Graph Template. Give it a name of your liking. Then, you'll have to add at least two more items, the non-unicast packets IN/OUT, respectively (to be exact, the unicast packets would also be needed, but they should be much lower in value). Add a nice legend for each of them to help us follow all the magic.
For now, lets associate this new Graph template to one of your hosts. Please wait for a couple of cycles to get data filled in. Then, please post a screenshot of the Graph and another one of the Graph Template. At last, please click on the wrench next to the graph and post the whole rrdtool graph statement.
This step gathers all raw data needed for further calculations.
We'll proceed to the next step soon.
Reinhard
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
Up to now, its OK.
Here is the Graph Template I created (by duplicating the discard/errors graph, and adding the unicast in/out and nonunicast in/out), and the screenshot of the graph newly created.
Here is the rrdtool graph command :
What's next ? ;o)
Here is the Graph Template I created (by duplicating the discard/errors graph, and adding the unicast in/out and nonunicast in/out), and the screenshot of the graph newly created.
Here is the rrdtool graph command :
Code: Select all
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="myroutername - Errors/Discards % - Serial0/0 - 2" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="errors/sec" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_in:AVERAGE \
DEF:c="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_out:AVERAGE \
DEF:d="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_out:AVERAGE \
DEF:e="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \
DEF:f="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \
DEF:g="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_in:AVERAGE \
DEF:h="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_out:AVERAGE \
LINE1:a#FFAB00:"Discards In" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#F51D30:"Errors In" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:c#C4FD3D:"Discards Out" \
GPRINT:c:LAST:" Current\:%8.2lf %s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:d#00694A:"Errors Out" \
GPRINT:d:LAST:" Current\:%8.2lf %s" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:e#FF00FF:"NonUnicast In" \
GPRINT:e:LAST:" Current\:%8.2lf %s" \
GPRINT:e:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:e:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:f#D8ACE0:"NonUnicast Out" \
GPRINT:f:LAST:"Current\:%8.2lf %s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:f:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:g#A150AA:"Unicast In" \
GPRINT:g:LAST:" Current\:%8.2lf %s" \
GPRINT:g:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:g:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:h#4668E4:"Unicast Out" \
GPRINT:h:LAST:" Current\:%8.2lf %s" \
GPRINT:h:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:h:MAX:"Maximum\:%8.2lf %s\n"
RRDTool Says:
OK
- Attachments
-
- Graph template
- graph_template_percentage.JPG (170.08 KiB) Viewed 19827 times
-
- Graph (only one polling made)
- graph_percentage.JPG (57.43 KiB) Viewed 19827 times
Last edited by chewbacca156 on Fri Apr 14, 2006 11:42 am, edited 1 time in total.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Fine. Now learn from the rrdtool graphall data sources, from a to h.
Now, it's time for the CDEFs. Create a new one, named it e.g. Packets - In. Add a Custom String Item reading:. Add another one for Out Packets using f,h instead of e,g.
Now, introduce two COMMENTS to your Graph Template. Each should refer Data Source = NONE, Color = NONE and CDEF = Packets -In and Out respectively. No text!. This will give us the sum of all packets IN/OUT.
If you want to compute the % values of Errors + Discards as a sum, you'll need another two CDEFs made up just as the first two.
This step was for summing only. Next step gives the Percentages.
Please again post all three resources like in your post above.
Reinhard
Code: Select all
DEF:a="/var/www/html/cacti/rra/cowanrtra_errors_in_1915.rrd":discards_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/cowanrtra_errors_in_1915.rrd":errors_in:AVERAGE \
DEF:c="/var/www/html/cacti/rra/cowanrtra_errors_in_1915.rrd":discards_out:AVERAGE \
DEF:d="/var/www/html/cacti/rra/cowanrtra_errors_in_1915.rrd":errors_out:AVERAGE \
DEF:e="/var/www/html/cacti/rra/cowanrtra_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \
DEF:f="/var/www/html/cacti/rra/cowanrtra_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \
DEF:g="/var/www/html/cacti/rra/cowanrtra_unicast_in_1917.rrd":unicast_in:AVERAGE \
DEF:h="/var/www/html/cacti/rra/cowanrtra_unicast_in_1917.rrd":unicast_out:AVERAGE \
Now, it's time for the CDEFs. Create a new one, named it e.g. Packets - In. Add a Custom String Item reading:
Code: Select all
cdef=e,g,+
Now, introduce two COMMENTS to your Graph Template. Each should refer Data Source = NONE, Color = NONE and CDEF = Packets -In and Out respectively. No text!. This will give us the sum of all packets IN/OUT.
If you want to compute the % values of Errors + Discards as a sum, you'll need another two CDEFs made up just as the first two.
This step was for summing only. Next step gives the Percentages.
Please again post all three resources like in your post above.
Reinhard
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
OK here is the graph template and the graph generated.
The rrdtool graph command :
Why are the comments empty ? Did I missed something ?
See you on tuesday.
Can't work on it from home, so i'll have to wait until tuesday for the end of the tutorial ;o)
The rrdtool graph command :
Code: Select all
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="myroutername - Errors/Discards % - Serial0/0 - 2" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="errors/sec" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_in:AVERAGE \
DEF:c="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_out:AVERAGE \
DEF:d="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_out:AVERAGE \
DEF:e="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \
DEF:f="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \
DEF:g="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_in:AVERAGE \
DEF:h="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_out:AVERAGE \
CDEF:cdefdc=e,g,+ \
CDEF:cdefdd=f,h,+ \
LINE1:a#FFAB00:"Discards In" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#F51D30:"Errors In" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:c#C4FD3D:"Discards Out" \
GPRINT:c:LAST:" Current\:%8.2lf %s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:d#00694A:"Errors Out" \
GPRINT:d:LAST:" Current\:%8.2lf %s" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:e#FF00FF:"NonUnicast In" \
GPRINT:e:LAST:" Current\:%8.2lf %s" \
GPRINT:e:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:e:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:f#D8ACE0:"NonUnicast Out" \
GPRINT:f:LAST:"Current\:%8.2lf %s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:f:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:g#A150AA:"Unicast In" \
GPRINT:g:LAST:" Current\:%8.2lf %s" \
GPRINT:g:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:g:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:h#4668E4:"Unicast Out" \
GPRINT:h:LAST:" Current\:%8.2lf %s" \
GPRINT:h:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:h:MAX:"Maximum\:%8.2lf %s\n" \
COMMENT:"" \
COMMENT:""
RRDTool Says:
OK
See you on tuesday.
Can't work on it from home, so i'll have to wait until tuesday for the end of the tutorial ;o)
- Attachments
-
- Graph template with the 2 comments (CDEF)
- graph_template_percentage2.JPG (192.87 KiB) Viewed 19819 times
-
- The new graph (but no comments ??)
- graph_percentage2.JPG (52.4 KiB) Viewed 19819 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
They are empty, because we won't need the data, only the CDEF they introduced (if you want to graph the sum, you may of course change from COMMENT to LINEx).chewbacca156 wrote:Why are the comments empty ? Did I missed something ?Code: Select all
DEF:a="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_in:AVERAGE \ DEF:b="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_in:AVERAGE \ DEF:c="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_out:AVERAGE \ DEF:d="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_out:AVERAGE \ DEF:e="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \ DEF:f="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \ DEF:g="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_in:AVERAGE \ DEF:h="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_out:AVERAGE \ CDEF:cdefdc=e,g,+ \ CDEF:cdefdd=f,h,+ \
Now it's time for tha last CDEFs. Let's do the Percentage for Discards-In. We'll need the cdefdc as the base and the DEF:a as the value.
Create a new CDEF, e.g. Discards In % which reads
Code: Select all
cdef=cdefdc,0,EQ,0,a,100,*,cdefdc,/,IF,0,110,LIMIT
cdefdc,0,EQ will return 1, if cdefdc equals 0, else 0.
a,100,* will return the Discards-In multiplied by 100
a,100,*,cdefdc,/ will return (Discards-In * 100 / sum of all packets)
Now the IF statement:
cdefdc,0,EQ,0,a,100,*,cdefdc,/,IF
If first element (cdefdc,0,EQ) is true (eq 1), return second value (0), else return third value (a,100,*,cdefdc,/). This yields the wanted percentage if, and only if, the sum of packets exceeds 0 (dividing by 0 problem!).
Last:
0,110,LIMIT
will limit the result to a value between 0 and 110 (this should do no harm at all).
Now insert a new Graph Item, e.g a LINEx, referring to that CDEF only. You may apply this procedure to Discards Out by changing the characters only, but this will require a new CDEF. This procedure is taken from Rolf Posers work for graphing Apache Statstics. If anyone knows a less complicated one (without scripts, eh!), please let me know.
Reinhard
PS: you will definitively notice a problem with the graph's y-axis, as the Non-Unicast Packets drawn will exceed the Percentage values by magnitude. If you've come this far, we'll discuss a solution for this. As always, please post your three resources.
Happy Easter to All of You
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
It seems to be OK.
But now, can I remove the graph and legends of the other values ?
I only want the % values.
Here is the command debug :
But now, can I remove the graph and legends of the other values ?
I only want the % values.
Here is the command debug :
Code: Select all
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="myroutername - Errors/Discards % - Serial0/0 - 2" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="errors/sec" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_in:AVERAGE \
DEF:c="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_out:AVERAGE \
DEF:d="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_out:AVERAGE \
DEF:e="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \
DEF:f="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \
DEF:g="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_in:AVERAGE \
DEF:h="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_out:AVERAGE \
CDEF:cdefdc=e,g,+ \
CDEF:cdefdd=f,h,+ \
CDEF:cdefde=cdefdc,0,EQ,0,a,100,*,cdefdc,/,IF,0,110,LIMIT \
CDEF:cdefdi=cdefdd,0,EQ,0,b,100,*,cdefdd,/,IF,0,110,LIMIT \
CDEF:cdefec=cdefdc,0,EQ,0,c,100,*,cdefdc,/,IF,0,110,LIMIT \
CDEF:cdefeg=cdefdd,0,EQ,0,d,100,*,cdefdd,/,IF,0,110,LIMIT \
LINE1:a#FFAB00:"Discards In" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#F51D30:"Errors In" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:c#C4FD3D:"Discards Out" \
GPRINT:c:LAST:" Current\:%8.2lf %s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:d#00694A:"Errors Out" \
GPRINT:d:LAST:" Current\:%8.2lf %s" \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:e#FF00FF:"NonUnicast In" \
GPRINT:e:LAST:" Current\:%8.2lf %s" \
GPRINT:e:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:e:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:f#D8ACE0:"NonUnicast Out" \
GPRINT:f:LAST:"Current\:%8.2lf %s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:f:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:g#A150AA:"Unicast In" \
GPRINT:g:LAST:" Current\:%8.2lf %s" \
GPRINT:g:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:g:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:h#4668E4:"Unicast Out" \
GPRINT:h:LAST:" Current\:%8.2lf %s" \
GPRINT:h:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:h:MAX:"Maximum\:%8.2lf %s\n" \
COMMENT:"" \
COMMENT:"" \
LINE1:cdefde#F51D30:"Discards IN %" \
GPRINT:cdefde:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefde:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefde:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefdi#FF0000:"Errors IN %" \
GPRINT:cdefdi:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefdi:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefdi:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefec#C4FD3D:"Discards OUT %" \
GPRINT:cdefec:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefec:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefec:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefeg#C4FD3D:"Errors OUT %" \
GPRINT:cdefeg:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefeg:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefeg:MAX:"Maximum\:%8.2lf %s\n"
RRDTool Says:
OK
- Attachments
-
- graph_percentage3.JPG (68.79 KiB) Viewed 19728 times
-
- graph_template_percentage3.JPG (243.24 KiB) Viewed 19731 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Magnifique.chewbacca156 wrote:It seems to be OK.
But now, can I remove the graph and legends of the other values ?
I only want the % values.
The answer to your last question is yes and no. You may delete all the legend stuff for those data sources you won't see explicitely. But you mustn't delete the LINEx item for them. In case you do, you will loose the data source as well and this will make the calculations worthless.
Two options left:
This one will perhaps not produce the needed result, but try it first to understand the second approach: Please change the color of the "unwanted" LINEx items to FFFFFF (white). So they should not be seen. You may change this to NONE. But there were some items lately with color=NONE, so this may fail.
But you will notice (AFAIK), that the graph will not autoscale correctly. This is due to the fact, that autoscaling takes the largest value (NON-UNICASTs) into account, whether you see this or not. So this leads to the second approach.
You will again need some CDEF. As you're already experienced with this, I'll give only the formula: cdef=CURRENT_DATA_SOURCE,0,*; name this Make Current = 0 or the like. While this seems to be nonsense, please apply this to all data sources you want to suppress. The value yields 0, so this will not affect autoscaling anymore.
Reinhard
-
- Posts: 24
- Joined: Tue Apr 04, 2006 7:17 am
Woohoooo it works !
I deleted all the unwanted legends, empty the Text Format value of the LINEx items so that they disappeared of the legend.
Next I changed the color of these LINEx to white (FFFFFF), created the CDEF to make them null, and applied it to all the unwanted LINEx.
And now my graph is OK ;o)
Thank you so much for your help Reinhard.
Here are my last screenshots.
PS : Be careful to one last IMPORTANT thing :
after I deleted the legends, my graph failed because RRDtool changed the names of the values for CDEFs (cdefdc is now named cdefi, and cdefdd is now cdefj), so that all my CDEFs were false. Correct the CDEFs strings and it will be OK.
I deleted all the unwanted legends, empty the Text Format value of the LINEx items so that they disappeared of the legend.
Next I changed the color of these LINEx to white (FFFFFF), created the CDEF to make them null, and applied it to all the unwanted LINEx.
And now my graph is OK ;o)
Thank you so much for your help Reinhard.
Here are my last screenshots.
PS : Be careful to one last IMPORTANT thing :
after I deleted the legends, my graph failed because RRDtool changed the names of the values for CDEFs (cdefdc is now named cdefi, and cdefdd is now cdefj), so that all my CDEFs were false. Correct the CDEFs strings and it will be OK.
Code: Select all
/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="myroutername - Errors/Discards % - Serial0/0 - 2" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="percent" \
--slope-mode \
DEF:a="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_in:AVERAGE \
DEF:b="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_in:AVERAGE \
DEF:c="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":discards_out:AVERAGE \
DEF:d="/var/www/html/cacti/rra/myroutername_errors_in_1915.rrd":errors_out:AVERAGE \
DEF:e="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_in:AVERAGE \
DEF:f="/var/www/html/cacti/rra/myroutername_nonunicast_out_1916.rrd":nonunicast_out:AVERAGE \
DEF:g="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_in:AVERAGE \
DEF:h="/var/www/html/cacti/rra/myroutername_unicast_in_1917.rrd":unicast_out:AVERAGE \
CDEF:cdefa=a,0,* \
CDEF:cdefb=b,0,* \
CDEF:cdefc=c,0,* \
CDEF:cdefd=d,0,* \
CDEF:cdefe=e,0,* \
CDEF:cdeff=f,0,* \
CDEF:cdefg=g,0,* \
CDEF:cdefh=h,0,* \
CDEF:cdefi=e,g,+ \
CDEF:cdefj=f,h,+ \
CDEF:cdefba=cdefi,0,EQ,0,a,100,*,cdefi,/,IF,0,110,LIMIT \
CDEF:cdefbe=cdefi,0,EQ,0,b,100,*,cdefi,/,IF,0,110,LIMIT \
CDEF:cdefbi=cdefj,0,EQ,0,c,100,*,cdefj,/,IF,0,110,LIMIT \
CDEF:cdefcc=cdefj,0,EQ,0,d,100,*,cdefj,/,IF,0,110,LIMIT \
LINE1:cdefa#FFFFFF:"" \
LINE1:cdefb#FFFFFF:"" \
LINE1:cdefc#FFFFFF:"" \
LINE1:cdefd#FFFFFF:"" \
LINE1:cdefe#FFFFFF:"" \
LINE1:cdeff#FFFFFF:"" \
LINE1:cdefg#FFFFFF:"" \
LINE1:cdefh#FFFFFF:"" \
COMMENT:"" \
COMMENT:"" \
LINE1:cdefba#FFAB00:"Discards IN %" \
GPRINT:cdefba:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefba:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefba:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefbe#FF0000:"Errors IN %" \
GPRINT:cdefbe:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefbe:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefbe:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefbi#6DC8FE:"Discards OUT %" \
GPRINT:cdefbi:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefbi:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefbi:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:cdefcc#4444FF:"Errors OUT %" \
GPRINT:cdefcc:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefcc:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefcc:MAX:"Maximum\:%8.2lf %s\n"
RRDTool Says:
OK
- Attachments
-
- Final Graph
- graph_percentage4.JPG (38.01 KiB) Viewed 19694 times
-
- Graph template
- graph_template_percentage4.JPG (148.7 KiB) Viewed 19694 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
I'm sorry for that inconvenience. But as I developed the whole thing from thin air, I didn't pay attention to that. Congratulations for getting this to work. And I assume you've learned a lot about CDEFs and some more advanced cacti magic.chewbacca156 wrote:PS : Be careful to one last IMPORTANT thing :
after I deleted the legends, my graph failed because RRDtool changed the names of the values for CDEFs (cdefdc is now named cdefi, and cdefdd is now cdefj), so that all my CDEFs were false. Correct the CDEFs strings and it will be OK.
Reinhard
-
- Posts: 40
- Joined: Mon Jan 28, 2008 4:11 am
Re: [HOWTO] Graph errors/discard in percent ?
Hello,
Please excuse the necroposting, I'm trying to achieve the same as this post describes.
But when I try to add the COMMENT to sum up unicast_in+nonunicast_in and unicast_out+nonunicast_out I see nowhere to reference the corresponding CDEF functions (or any other CDEF).
Only fields are:
Graph Item Type: [COMMENT]
Data Source: [None]
Text Format: []
Insert Hard Return: []
Sequence: []
Maybe something changed from 2006 to now. I'm using cacti 1.2.18.
Thank you in advance.
Please excuse the necroposting, I'm trying to achieve the same as this post describes.
But when I try to add the COMMENT to sum up unicast_in+nonunicast_in and unicast_out+nonunicast_out I see nowhere to reference the corresponding CDEF functions (or any other CDEF).
Only fields are:
Graph Item Type: [COMMENT]
Data Source: [None]
Text Format: []
Insert Hard Return: []
Sequence: []
Maybe something changed from 2006 to now. I'm using cacti 1.2.18.
Thank you in advance.
Who is online
Users browsing this forum: No registered users and 1 guest