Command line aggregate graph tool + data extraction tool

Addons for Cacti and discussion about those addons

Moderators: Developers, Moderators

Post Reply
User avatar
gninja
Cacti User
Posts: 371
Joined: Tue Aug 24, 2004 5:02 pm
Location: San Francisco, CA
Contact:

Command line aggregate graph tool + data extraction tool

Post by gninja »

Wrote these because they're very useful at my job. Hopefully they can be useful to others as well.

I've tested these on 0.8.6, they should work on any future releases that don't change the db schema too severely. If you're using them, please check the changelist before continuing to use them after a new cacti release. The data script will just error out if there's something changed.. But the aggregate graph tool MAY do horrible things if the database has changed too much.

I recommend editing the scripts and setting the db connection defaults to something appropriate for your network. The aggregate graph tool needs read, write, and delete privileges. The data extraction tool just needs read access to the database and the rrd files.

With the aggregate graph tool, you WILL need to add a CDEF called

Code: Select all

Total Similar Data Sources
The contents of that Data source should be:

Code: Select all

Item #1: Special Data Source: SIMILAR_DATA_SOURCES_NODUPS
Create the graphs you want aggregated, then shove:

Code: Select all

cacti_aggr_graph.py --autoupdate
Into your crontab, once a day.
If you add or remove hosts from your clusters, the aggregate graphs will be updated when the crontab runs. You could, if you wanted make an aggregate graph including everything in your cacti instance, but I wouldn't recommend that unless you don't have much data in your system. I've tested it with graphs of over 200 line items.

I store the data on how to recreate the graph, in the title field, in the db. The displayed title on the graph is from the title_cache field. The easiest way to retitle your graphs if you need to title them something a bit clearer, is the --title option.

Please use with care. Apologies for it not being a plugin, I work best in python these days. Full permission is given for anyone to take the code logic and convert to php, especially if you can figure out how to turn the auto-update part into a cacti plugin.
Attachments
cacti_aggr_graph.py.gz
Aggregate graph tool.
(5.41 KiB) Downloaded 467 times
get_cacti_data.py.gz
Cacti data extractor
(3.39 KiB) Downloaded 472 times
FreeBSD/RHEL
cacti-0.8.7i, spine 0.8.7i, PIA 3.1+boost 5.1
MySQL 5.5/InnoDB
RRDtool 1.2.27, PHP 5.1.6
kidzeivo
Posts: 11
Joined: Tue Jan 26, 2010 5:00 am

Command line to Aggregate traffic from 2 interfaces

Post by kidzeivo »

I will like to ask if your script can be used to aggregate traffic from 2 interface. I want to write a script that will create an aggregate graphs of 2 interface for 1000 devices. Is this possible with your script?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest