[HOWTO] Cross Host Multiple Datasource Aggregate 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

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

[HOWTO] Cross Host Multiple Datasource Aggregate Graphs

Post by gninja »

Anyway, I've dug through the boards to figure out how to do [see title], and managed to cobble one together, and figured I'd write up what I did, to help others do it, and to see if there's a cleaner way to do anything that I've done.

I started with a relatively simple one. I have three hosts (1,2,3), with two datasources each(a,b) that I wanted to have on an aggregated graph.

I wanted to see the average of datasource a[1-3] and the average of datasource b[1-3], in one place.

1) First add a dummy host. I picked my monitoring box, since I don't normally poll it for any data.

2) The second thing that I should have done, but did not, was copy the associated Data Templates, give the new ones a tag at the end of the name of '- Inactive', and unselecte tha data source active checkbox.
I did not do this (but will for future graphs) because the query for this will always return an Unknown if it's hitting the wrong box, which shouldn't screw up my real data. If you aren't sure that's the case, make sure duplicate and deactivate your Data Template!

3) Then do a search for the data sources you need. In the data source search window, selected the sources from the original hosts, pull down to duplicate, and hit that happy Go button.

4) Then you'll go into each duplicated rra, change the Host pulldown and altered the Data Source Path (VERY IMPORTANT). If you followed step two, you'll want to change your Data Template as well.

5) After that, you'll want to copy the Graph Template for the graph that you're aggregating. Go to Graph Templates do a search, click the box, pulldown to Duplicate, and hit Go. (You could have also just created the new graph with the old template, then removed the template.)

6) Now, before we create the new graph, we need to create a new CDEF. Click Graph Management, Click CDEFs, click add.
Name the new CDEF x/y, where y is the number of hosts you're aggregating. In my case, I named it x/3. CDEF items should be:
Special Data Source: CURRENT_DATA_SOURCE
Custom String: 3 (or the number of hosts that you're aggregating.)
Operator: /

Now create another one, name it: Average Similar/3. I'm not 100% sure that I did this part right, but the end numbers on the graph look accurate. Add CDEF items:
Special Data Source: SIMILAR_DATA_SOURCES_NODUPS
Custom String: 3 (or the number of hosts that you're aggregating)
Operator: /

7) Now go back to Graph Templates. Edit your template. If you only have one data source, skip any parts where I talk about a second. If you have more than 2, well, read carefully and come up with your own way to display that properly.
In my case, I had a line for Data Source 'a', three gprints, a line for Data Source 'b' and three more gprints. I changed the first line into an area. And left the second line alone.
Add a stack datasource of the same type as DS'a', with a similar color but different enough to be distinguishable.. Move that up to be the second item. Add another stack of the same type as DS'a' Move that up to be the third item. If you have more that three hosts that you're aggregating, continue. Edit items 1-3, setting the CDEF to x/3 and saving. You may wish to give item #3 a hard return.

8) Edit the Current/Average/Maximum GPRINTs if you have them, for Data Source 'a'. Set the CDEF to Average Similar/3.

9) Repeat step 7, but for Data Source 'b'. Use lines instead of Stacks. If you have to seperate Area/Stack groups on a graph, the second one will overwrite the first.

10) Repeat step 8, for the Data Source 'b' GPRINTs.

11) Add graph template to Host.

12) Add graph.

13) View Graph. Cheer.


That's it. Any questions? Any ideas on how to streamline this process? How to improve clarity and readability?

I've got a 25 host grouping, with a graphs that have up to 4 data sources that I'm going to be aggregating, and anything that can lube this up would be lovely.
User avatar
gninja
Cacti User
Posts: 371
Joined: Tue Aug 24, 2004 5:02 pm
Location: San Francisco, CA
Contact:

Screenshot of Graph

Post by gninja »

Here's a screenshot of the final graph.
Attachments
graph_image.php.png
graph_image.php.png (7.4 KiB) Viewed 33083 times
TPC
Posts: 29
Joined: Wed Oct 06, 2004 12:14 pm

Post by TPC »

This guide is great, only a few question though, why did you need to do a CDEF to divide your stuff by 3?... I used your info here as a rough guide and managed to cobbled up my own cross host multiple data source graph :P

first, duplicate the data source you want to use, and turn them 'inactive' by ticking off the 'data source active' option in them.
next, duplicate the graph template you want to use so that it's easier to adjust some settings via the graph template and not affect your other graph.
create a dummy host like this guide said, I too use a localhost. now associate the data source to this host (go to data source, and the first option should be to select which device this data source belongs to, just switch them to the localhost you just created - plus remember to change the RRA filename, cause by duplicating the previous data source, cacti creates NEW RRA files,so when you're duplicating them, it's probably best to duplicate, remember the original RRA's path and rra filename, copy that across to the duplicate immediately and associate it with the duplicated graph template too!).. sounds confusing but you'll get the hang of it after a few attempts.. I know i did :P

now go modify the new duplicated graph template to your liking. add in multiple graph item input - each for every data source you want to add in.

after that, go to that device, associate the new graph template to it, and create the graph. once greated, go ot graph management, take a look at that graph, and you will need to select the actual data source (because by default it selects some dummy source which won't get you any graph).. save, it will go back out into the main page. click back in to see your graph :)

this method works for me, though if anyone has any shorter, better and more efficient ideas, i'd welcome it :)

if only there was a way to associate 1 data source to more than 1 device. (make the first association a 'primary' active one, while the others are just reading from that data source..) - or is that something that's possible in cacti, just that I don't know how to do it ?... :roll:
TPC
Posts: 29
Joined: Wed Oct 06, 2004 12:14 pm

Post by TPC »

Here's how my graph looks like..
:P
Attachments
Snap1.png
Snap1.png (15.01 KiB) Viewed 32989 times
Axis
Posts: 6
Joined: Tue Sep 20, 2005 9:07 am
Location: Tilburg, the Netherlands

Post by Axis »

Pff.. what a hassle. But worth the effort!
Attachments
graph_image.png
graph_image.png (14.99 KiB) Viewed 27978 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may do the first 5 steps by using AGGREGATE plugin. Yet, the TOTAL is not a feature of this plugin and will still be left to your manual effort
Reinhard
drawkcab
Posts: 10
Joined: Wed Mar 08, 2006 8:16 am

Post by drawkcab »

Axis, how did you stack your STACK items above your STACK items ?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

drawkcab wrote:Axis, how did you stack your STACK items above your STACK items ?
Using multiple AREAs will "overlay" those, starting with the first one. STACKs will be stacked upon the most recent AREA.
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests