Cacti (home)ForumsDocumentation

unifiedtrees

type:
userplugin
userplugin:
unifiedtrees
author:
ericdives
description:
Pull tree information for the graph tree view from multiple Cacti installs and a display them as a single tree.
version:
0.8
pia:
3.1 tested
cacti:
0.8.8b
homepage:
http://runningoffatthemouth.com/?p=1089
date:
2013-04-12
plugins:
graph_view trees

Download

Latest version available here.

Purpose

If you have multiple Cacti installs for a enterprise/university campus, navigating between them can be somewhat troublesome. That's where Unified Trees comes in. Unified Trees will pull tree information from the independent Cacti databases for the different Cacti servers and put a single tree together, with links to the remote servers for remote host/graph entries. Configure Unified Trees on all of your servers similarly and fully mesh the database connections, and navigation between server instances will be essentially seamless.

Features

Provides a single, easy to navigate tree to navigate between Cacti servers (providing your different Cacti servers have trees that mesh well and make some sort of sense). Essentially allows for links to hosts on other Cacti servers in the tree - click on those links, and *poof* you're on the other server.

0.5 introduced “client/server” settings, where a Cacti install designated as a “server” will sweep all configured “client” systems (and itself) to build a tree and save it in a memory based table at some regular interval. “Client” systems then pull the resulting tree from the server without having to connect to the other “client” systems. This should (at the expense of having up to the minute devices in the tree) simplify plugin deployment and speed rendering of a tree (since it is pre-built).

0.7 introduced the “Other” tree - a tree name you can specify that, when the trees are displayed, is put at the bottom of the list of trees.

0.8 introduced handling of “disabled” hosts so that if they are “enabled” on a different Cacti host, both entries will show up in the tree.

Prerequisites

Requires Cacti 0.8.8b (the tar.gz versions, downloaded from Cacti's site; plugin is not supported under Windows), and at least some idea as to what “patch” does; also, some idea as to how MySQL access works from remote machines.

CactiEZ, Linux distribution provided packages or other repo (read: EPEL) provided packages, even if they are 0.8.8b based, may have made modifications to lib/html_tree.php, in which case, the patch will fail. If this occurs, the ability of the developer to provide assistance is severely limited.

The ZIP download has all files in “dos” text format (usually contains a carriage returns as well as line feeds at the end of lines). While this format, when viewed in many file editing programs, will look identical to the tar.gz Linux download, patch will fail completely to patch the file.

Installation

  1. Download the plugin, and untar/decompress (“tar xzf”) into your Cacti plugins directory.
  2. Use the “Plugin Management” settings to “install” and “activate” the plugin. If you’re not using the user “admin” or templated to the user “admin”, you may need to look at your user settings to add the Unified Trees realm.
  3. First, check the settings for Unified Trees. You’ll find them under “Settings” – “Visual” tab. You could select “Use Unified Trees” now, but you might want to wait for a bit; save the settings when configured as desired. You can configure the system as a “server” by setting a “Tree Build” interval, or as a client by choosing “Client”.
  4. On the “Console” tab, look under “Utilities” for the “Unified Trees – Sources”. Go in and add your source databases; be aware that the various Cacti servers will need users configured for each server attempting to access their databases (a “server” will need connections to all “clients”, but a “client” only needs access to the “server(s)”. The only GRANT privilege a given Cacti server will need is SELECT, so “GRANT SELECT ON cacti.* TO 'othercacti'@'otherip' IDENTIFIED BY 'password';” (substituting the appropriate db username, Cacti server address, and password) should suffice. Don’t forget about iptables/local firewall rules. Be aware that after adding a source, the plugin does a connectivity test; if that fails, it will automatically disable the database (but it will leave your settings as configured).
  5. You will have to patch a core file, and the patches are version specific. For the initial release, only Cacti 0.8.8b is supported. For Linux users, this should only require changing directory to the root of your Cacti install as a user capable of writing files to your Cacti directory (I.E., root), and running: “patch -b -p0 < plugins/unifiedtrees/patch-0.8.8b/html_tree.diff” The patch has been designed to be of minimal impact; you can apply the patch and uninstall the plugin, and Cacti should run normally. In fact, if the “unifiedtrees” plugin is not active, or “Use Unified Trees” is not checked in the settings, you’ll use the original tree code.

Upgrading from 0.1/0.5

Please be aware that if you were running 0.1 or 0.5, to fully upgrade Unified Trees to later versions requires “repatching” lib/html_tree.php. Providing you followed the instructions above properly (using ”-b” on your patch command):

  1. From your Cacti base directory: mv lib/html_tree.php.orig lib/html_tree.php
  2. Then: patch -b -p0 < plugins/unifiedtrees/patch-0.8.8b/html_tree.diff

Usage

Assuming you have your servers “fully meshed” (or use the “client/server” options properly), and some kind of Single Sign-On option in place (or unauthenticated access to your graphs), when looking at the graphs in “tree” mode, you should be able to see all of your Cacti servers' trees put together into one tree, and you should be able to navigate from server to server easily.

Additional Help?

If you need additional help:

The "Issues" section on GitHub is a good place to start.

The forum post for the plugin is another option.

Possible Bugs?

For 0.6: I still haven't tested/coded for the possibility of attaching a “Graph” as a leaf item, only Hosts. I leave that to someone who wants that functionality that isn't afraid to take a look at my code.

20140110: Spotted a bug I'm surprised I hadn't encountered yet, and it should exist in both 0.1 and 0.5. If you have multiple Tree roots, it's possible that across servers there will be collisions between the “xID”, which is used to control several things, not the least of which are:

  • The (supposedly) unique identity of an entry on the fully built tree,
  • It also maps to the URL that's built to display the selected host/graphs.

The bug was fixed in 0.6 but requires unpatching/repatching lib/html_tree.php.

One “not a bug, but a feature”: If you restrict access to certain graphs via permissions, those permissions will be bypassed with UT.

If you've got an issue, let's start at the GitHub issues page for the project.

Screenshots






Personal Tools