[HOWTO] How can I make SUM of graphs

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

Big_Tummy
Posts: 1
Joined: Mon Sep 01, 2003 9:14 am

[HOWTO] How can I make SUM of graphs

Post by Big_Tummy »

Hello All,

I'm newbie on CACTI.

Is it possible to make SUM on CACTI?

If yes, how can I do it?

Regards,
José Esteves
-------------------------------------------------------
"DVBITANDO, AD VERITATEM PARVENIMVS... ALIQVANDO!"
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Yes, this is possible with the latest version of Cacti. It is described in a bit more detail in the following page of the manual under "Bandwidth Summation".

If you are a new user of Cacti, the easiest way to create graphs with a sum already on them is to:

1) Go to "Polling Hosts" in Cacti.
2) Either add a new host or edit a host that contains traffic you want to sum up.
3) Make sure you have the "SNMP - Interface Statistics" data query selected by selecting "SNMP - Interface Statistics" under "Associated Data Query" and clicking "Add".
4) Place a checkbox next to the interfaces you want to create summation graphs for.
5) Click on the dropdown that says "In/Out Bits" and select "In/Out Bytes with Total Bandwidth".
6) Once you click save, you should have some graphs that contain summation data on them :).

The following set of instructions assumes that you want to sum up traffic, which is most often the case. You are not limited to this however. The instructions provided in the manual should work for any type of data.

-ian
Guest

Post by Guest »

rax wrote

1) Go to "Polling Hosts" in Cacti.
2) Either add a new host or edit a host that contains traffic you want to sum up.
3) Make sure you have the "SNMP - Interface Statistics" data query selected by selecting "SNMP - Interface Statistics" under "Associated Data Query" and clicking "Add".
4) Place a checkbox next to the interfaces you want to create summation graphs for.
5) Click on the dropdown that says "In/Out Bits" and select "In/Out Bytes with Total Bandwidth".
6) Once you click save, you should have some graphs that contain summation data on them .
I have just upgraded to 0.8.3a and I have tried to create a total bandwidth graph using the instructions above but when I click on the dropdown to shoose In/Out Bytes with Total Bandwidth this option is unavailable. Did my upgrade not complete properly? Is there some way i can confirm the validity of my install?

Thanks for the help
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

More than likely your installation is just fine. You will only see this option for new installations of version 0.8.3a, not for upgrades from previous versions. This is intentional as I try to refrain from messing with a user's database too much during an upgrade. One of the features coming up in the next version will allow you to export/import this kind of thing to/from an XML file to share with others.

If you want bandwidth summation on your graphs, you will have to modify your traffic template manually. Here is a good working variable:

Code: Select all

|sum:auto:current:2:auto|
-Ian
Fred
Cacti User
Posts: 81
Joined: Fri Jan 03, 2003 11:43 am

Post by Fred »

raX wrote:One of the features coming up in the next version will allow you to export/import this kind of thing to/from an XML file to share with others.
Woohoo!

I think this will really make cacti take off as people build templates for various host types.
atrocity
Posts: 18
Joined: Tue Aug 26, 2003 10:04 am

Post by atrocity »

Hello,

I followed Rax's HowTo for the summation, but it's not working for me ....
I deleted everything (my rra files also ;( ) and re-install Cacti from scratch. Then i followed the HowTo, without success...
Can some one help me ?
Thanks
Best regards
Jean
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

atrocity wrote:Hello,

I followed Rax's HowTo for the summation, but it's not working for me ....
I deleted everything (my rra files also ;( ) and re-install Cacti from scratch. Then i followed the HowTo, without success...
Can some one help me ?
Thanks
Best regards
Jean
Are you getting broken graphs when trying to use bandwidth summation? If you click "view source" below any of these graphs, are any errors displayed? What variable are you using on your graphs to display bandwidth summation?

-Ian
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

raX wrote:Yes, this is possible with the latest version of Cacti. It is described in a bit more detail in the following page of the manual under "Bandwidth Summation".

If you are a new user of Cacti, the easiest way to create graphs with a sum already on them is to:

1) Go to "Polling Hosts" in Cacti.
2) Either add a new host or edit a host that contains traffic you want to sum up.
3) Make sure you have the "SNMP - Interface Statistics" data query selected by selecting "SNMP - Interface Statistics" under "Associated Data Query" and clicking "Add".
4) Place a checkbox next to the interfaces you want to create summation graphs for.
5) Click on the dropdown that says "In/Out Bits" and select "In/Out Bytes with Total Bandwidth".
6) Once you click save, you should have some graphs that contain summation data on them :).

The following set of instructions assumes that you want to sum up traffic, which is most often the case. You are not limited to this however. The instructions provided in the manual should work for any type of data.

-ian
Hi,
I read Graph variables section of cacti. I use |

Code: Select all

sum:(auto):(current):(2):(auto)|
I copy this both line to Graph Templates/Interface Traffics(bits/sec)/Graph Item/Item#2 (it is gprint ,shows Current:)/Values and Text format. Then I turn to graph page. I see that No values. Just text as

Code: Select all

|sum:(auto):(current):(2):(auto)|
What is my mistake?
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

raX wrote:Yes, this is possible with the latest version of Cacti. It is described in a bit more detail in the following page of the manual under "Bandwidth Summation".

If you are a new user of Cacti, the easiest way to create graphs with a sum already on them is to:

1) Go to "Polling Hosts" in Cacti.
2) Either add a new host or edit a host that contains traffic you want to sum up.
3) Make sure you have the "SNMP - Interface Statistics" data query selected by selecting "SNMP - Interface Statistics" under "Associated Data Query" and clicking "Add".
4) Place a checkbox next to the interfaces you want to create summation graphs for.
5) Click on the dropdown that says "In/Out Bits" and select "In/Out Bytes with Total Bandwidth".
6) Once you click save, you should have some graphs that contain summation data on them :).

The following set of instructions assumes that you want to sum up traffic, which is most often the case. You are not limited to this however. The instructions provided in the manual should work for any type of data.

-ian
Hi,
I read Graph variables section of cacti. I use |

Code: Select all

sum:(auto):(current):(2):(auto)|
I copy this both line to Graph Templates/Interface Traffics(bits/sec)/Graph Item/Item#2 (it is gprint ,shows Current:)/Values and Text format. Then I turn to graph page. I see that No values. Just text as

Code: Select all

|sum:(auto):(current):(2):(auto)|
What is my mistake?
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

You don't want to include the parenthesis in the variable. Instead, you should use:

Code: Select all

|sum:auto:current:2:auto|
-Ian
smartinez
Posts: 21
Joined: Thu Mar 13, 2003 10:29 am
Location: Austin, Texas

Post by smartinez »

While on the topic of summation... :)

We have a Cisco 6513 that hosts multiple groupings of servers. For example, ports 1 - 5 terminate 5 servers that belong to one group (group1), ports 6 - 10 terminate 5 servers that belong to another group (group2), etc.

I want to take the total throughput of group1 and the total throughput of group2 and graph them together on one graph.

As a test, I used the "Total All Data Sources" found in the "Graph Items" section to create a total of ports 1 - 5 and it worked great. I got a graph that shows all 5 interfaces plus a 6th line that is the total of all 5.

So, I want to take that 6th line and the 6th line of the second graph and combine only those 2 on one graph.

Am I trying accomplish something out of the scope of Cacti?

I tried to use the "Bandwidth Summation" process listed below but what I got was individual interface graphs with the sum of all graphs listed at the bottom of each graph.

Thanks for all your assistance!

-Samson
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Trying to combine the "Total All Data Sources" which is CDEF based and the bandwidth summation which is variable based will not work. The main difference is that RRDTool handles the CDEFs, while Cacti handles any graph variables such as 95th percentile and bandwidth summation. The only way to do this would be to add a graph variable called "total all data sources", which would be much slower than the RRDTool way.

-Ian
atrocity
Posts: 18
Joined: Tue Aug 26, 2003 10:04 am

Post by atrocity »

raX wrote:
atrocity wrote:Hello,

I followed Rax's HowTo for the summation, but it's not working for me ....
I deleted everything (my rra files also ;( ) and re-install Cacti from scratch. Then i followed the HowTo, without success...
Can some one help me ?
Thanks
Best regards
Jean
Are you getting broken graphs when trying to use bandwidth summation? If you click "view source" below any of these graphs, are any errors displayed? What variable are you using on your graphs to display bandwidth summation?

-Ian
Hello,

I deleted every Polling Host, the recreated it like the how to of this thread.
Now, after about 15 minutes, i can see the Daily graph. Think i have to wait, that cacti generate the 3 others, no ?

Here is the 'view source' :
/usr/local/rrdtool-1.0.45/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--title="Switch Cisco XL2924 - Traffic - Fa0/1" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
DEF:a="/home/virtual/site10/fst/var/www/html/rra/switch_cisco_xl2924_ds0_172.rrd":ds0:AVERAGE \
DEF:b="/home/virtual/site10/fst/var/www/html/rra/switch_cisco_xl2924_ds0_172.rrd":ds1:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdeff=b,8,* \
AREA:cdefa#00CF00:"Inbound" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total In: 1.11 GB\n" \
LINE1:cdeff#002A97:"Outbound" \
GPRINT:cdeff:LAST:"Current\:%8.2lf %s" \
GPRINT:cdeff:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdeff:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total Out: 1.2 GB"

I can't see anything about summation ... ;(
Don't you receive my PM ? I mailed you the url and the admin password...
Thanks
Jean
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

atrocity wrote:I deleted every Polling Host, the recreated it like the how to of this thread.
Now, after about 15 minutes, i can see the Daily graph. Think i have to wait, that cacti generate the 3 others, no ?
I have actually experienced this problem once myself, unfortunately after I released 0.8.3a ;-). The problem will fix itself (all four graphs will work) after 24 hours. Sorry about the inconvenience, it will be fixed in the next version.

-Ian
atrocity
Posts: 18
Joined: Tue Aug 26, 2003 10:04 am

Post by atrocity »

ehm, excuse my stupid question, but this summation, is it IN the graphs ?
If yes, then it's ok ... it's working.
But what i really want, is the possibility to put tables, with the summary of the trafic in numbers...
I have a nice PHP script, that can summarize the trafic. You can choose to see the results for a period of days, or for a whole mounth, also a year if you collected the data... Really, i will appreciate if something like that can be done in Cacti, because actually i continue to use MRTG, only for that feature ....
I will be more then happy to share this script, if someone think that it can be used / converted to and for Cacti ;)
Jean
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests