Totalling two data sources

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
slidge
Posts: 2
Joined: Fri Jul 28, 2006 10:45 am

Totalling two data sources

Post by slidge »

I need to create a graph that is the total traffic in/out of some data sources.

I have five users, and I need to create a single graph (much like the standard traffic graph) that shows the total in and total out traffic of the five separate switch ports these users use.

Using the CDEF "Total All Data Sources" I can create a single graph that shows all of their inbound, and another graph that shows all of their outbound, but I haven't figured out a way that I can show both the total inbound and outbound on the same graph.

Is this possible? Do I need to construct a new CDEF?

Thanks for any help.
slidge
Posts: 2
Joined: Fri Jul 28, 2006 10:45 am

Post by slidge »

Yes, that was the first thing that I looked at.

What that would allow me to do is create a single total for all of the data sources.

However, what I need is two totals - a total summation of all of the data sources for inbound traffic, and a total summation for all of the outbound traffic data sources.

I can't figure out how to do totals of two different groups of data sources on the same graph.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

All that's needed is a bit CDEF magic. Please post the DEBUG (whole rrdtool graph statement) from Graph Management for the current graph. I'll return the CDEFs
Reinhard
NSTech
Posts: 6
Joined: Wed Aug 16, 2006 2:45 pm

I'm having the same issues

Post by NSTech »

I'm having the same problem. I want to create a graph that will display the aggregate incoming and outgoing bandwidth of two router interfaces as if they were one. Here is my RRDTool output from Graph Management:

/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="NETI - Traffic - ATT Multilink" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
--slope-mode \
DEF:a="/usr/local/share/cacti/rra/neti_traffic_in_563.rrd":traffic_in:AVERAGE \
DEF:b="/usr/local/share/cacti/rra/neti_traffic_in_563.rrd":traffic_in:AVERAGE \
CDEF:cdefa=TIME,1155758389,GT,b,b,UN,0,b,IF,IF,TIME,1155758389,GT,b,b,UN,0,b,IF,IF,+ \
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\: 286.47 MB\n" \
LINE1:cdefa#002A97:"Outbound" \
GPRINT:cdefa:LAST:"Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total Out\: 286.47 MB"

The generated graph should show the aggregate incoming (interface1+interface2) traffic as a green area graph. The outbound graph is not working, but should be an aggregate (interface1+interface2) blue line graph.

All the Current/Average/Max/Total metrics are set to CDEF 'Total All Data Sources', as are both the AREA and LINE1 graphs. Thus, the 'Inbound' and 'Outbound' data are both identical - but are only correct as 'Inbound' data.

Any help you can give would be appreciated!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

First, you'll have to make sure, that all needed data sources are present as DEF. Currently, there's only "IN" stuff. Even, if you do not want to see this "raw" data source, it has to be present (make color=while and apply a CDEF=CURRENT_DATA_SOURCE,0,* if this applies)
Reinhard
NSTech
Posts: 6
Joined: Wed Aug 16, 2006 2:45 pm

Post by NSTech »

Reinhard -

OK, now it seems like I have a new problem! Sorry for not noticing this before, but I had actually built several different data sources that didn't end up represented in the RRD command - or on the graph (obviously). I've made two inbound, two outbound and two CDEF data sources. The inbound and outbound sources get set to not display on the graph, and the CDEF function sources are set to total all data sources and display on the graph. However, Cacti isn't saving this! Each time I save the graph, it sets the data sources back to 'None' and keeps the RRD command the same (where DEFs are concerned: DEF:a="/usr/local/share/cacti/rra/neti_traffic_in_561.rrd":traffic_in:AVERAGE \
DEF:b="/usr/local/share/cacti/rra/neti_traffic_in_561.rrd":traffic_out:AVERAGE \)

Do I have to edit the RRAs manually?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests