
Cacti Weathermap: Network Visualization + Interactive

In this post I want to introduce readers to the wonderful plugin for the Cacti monitoring system - Weatnermap. For myself, of all the variety of useful additions to Cacti, I find Weathermap the most useful. With its help, the administrator is able to create network cards (physical, logical or just a separate section and / or nodes), the main purpose of which is to visualize the loading of network interfaces (although it is thus possible to visualize any graph).
I’ll tell you how to install the plugin, configure, analyze the configuration of the card.
It seems to me that if you look at a couple of graphs, then everything will become much clearer than I will try to tell. To demonstrate the possibilities, some cards are taken from the Internet.
Example No. 2:

Example No. 3:

Installation
To install the plugin, we need to do two things: install the plugin architecture and install the Cacti plugin itself. If you have already installed any plugins, then you can safely skip the installation section of the architecture.
1. Installing the plugin architecture
1.1. Download the Plugin Architecture (PIA) plugin architecture .
1.2. In the archive we will find the files folder, and two files pa.sql and cacti-plugin-0.8.7h-PA-v3.0.diff (the name of the patch depends on the version of the downloaded architecture, the last one at the time of writing).
1.3. Copy everything from the files directory to the folder with Cacti installed (I have (Debian) - / usr / share / cacti / site /). In the same folder, copy the patch cacti-plugin-0.8.7h-PA-v3.0.diff.
1.4.Run the patch #patch -p1 -N <cacti-plugin-0.8.7h-PA-v3.0.diff.
1.5. We make changes to the database - #mysql –u cactiuser –p cacti <pa.sql. Where, cactiuser is the cacti database user.
1.6. We correct way to /usr/share/cacti/site/include/global.php file (in your version of * nix path may be different):
changing the path to the RRA bases:
$config["rra_path"] = $config["base_path"] . ‘/rra’;
on
$config["rra_path"] = ‘/var/lib/cacti/rra’;
and the right to install adodb module:
include_once($config["library_path"] . “/adodb/adodb.inc.php”);
on
include_once(“/usr/share/php/adodb/adodb.inc.php”);
URL-path change (at me Cacti is available at domain.com/cacti/):
$url_path = ““;
at
$url_path = “/cacti/“;
1.7. In the file /usr/share/cacti/site/include/config.php (or /etc/cacti/debian.php - it is connected in config.php) we add: Now when you need to add a plugin - you just add one line into the configuration.
$plugins = array();
$plugins[] = 'weathermap';
Attention! It is recommended that you install the plugin architecture on a newly installed Cacti. I installed both the newly installed Cacti and the working one (in particular for this post). If you will install the architecture on a working Cacti, then after performing the actions of section No. 1 and opening the domain.com/cacti page in the browser, you will see the cactus installation dialog. Do not be alarmed, and in the drop-down list, select not “New install”, but “Upgrade”. Click “Next” and everything will be fine. But in no case do not forget about backup copies of the database and files!
2. Installing Weathermap
This step is the easiest. We performed the entire main task in section No. 1.
2.1. Download Weathermap - http://www.network-weathermap.com/download .
2.2. Unpack the archive into the plugins folder: / usr / share / cacti / site / plugins /.
If in the future we want to add more plugins, it will only be necessary to unpack them into this folder and add a line to the configuration (
$plugins[] = 'weathermap';
). If you did everything correctly, you should see something like this:

Customization
1. Create a map.
To create a map, you must use the editors. To activate it, set $ ENABLED = true in the file /usr/share/cacti/site/plugins/weathermap/editor.php. The editor looks like this:

In the editor you can create a map from scratch or as a copy of an existing one.
2. The map editing window looks like this:

Using the main menu it is possible: to set map parameters (size, background, signatures, legends, styles, layouts):


If we are not comfortable with a set of standard backgrounds, you can upload your own. This is done by placing the image in the folder / usr / share / cacti / site / plugins / weathermap / images /.
3. Adding items to the map.
The main elements of the map are nodes (nodes) and links (links). Equipment on the map is displayed by nodes. It should be noted that the main parameter of a node is its image. The standard set is not rich, but if you need your own image for the node, you can upload it to the folder / usr / share / cacti / site / plugins / weathermap / images /.
Nodes are linked by links. To add a link, we click on the button of the main menu “Add Link”, then on the first device and on the second. I want to note that the order of pressing on devices is important. The fact is that we added the connection, but it is not tied to any of the graphs:

To bind, we click on the connection and select the source - a graph from Cacti:

So, the source should be the device on which we clicked first when building the connection. If you select the second device, then the load of links will be mirrored (with a large return of traffic it will show an increase in incoming traffic).
You do not need to save the map in any way. When creating a map, a map configuration file is created (in our case / usr / share / cacti / site / plugins / weathermap / configs / TEST, TEST is the name of the map). To display a map in Cacti itself, you must add its list of displayed maps. To do this: Console-> Weathermap-
> Add, select the created map and click Add again:

If after that we click on the Weathermap tab, then we will see our map (it is created within 5 minutes, after working out the poller). The example is elementary, but enough to understand how to create a map: The

map is created and we can observe the loading of links. But in order to find out specific values, you need to click directly on the connection and there will be a transition to a specific schedule in Cacti. I will say that it is not convenient. It is much more convenient to get values just by moving the mouse to the graph. This is set up like this. A line is added to the configuration file (/ usr / share / cacti / site / plugins / weathermap / configs / TEST)
HTMLSTYLE overlib
. And it looks like this: 
An example of a configuration file you can find here ( http://pastebin.com/zJT9hUw2) There is nothing complicated in the structure. Describes the coordinates of nodes, links, binding lines to specific graphs and general map parameters (sizes, colors, font types, etc.).
Thanks to the modular architecture, Cacti is easily expandable, and not a small set of plug-ins (please note free) allows you to organize good monitoring of many parameters of various equipment.
Sources
1. One of the very first / interesting entries. forum.lissyara.su/viewtopic.php?f=3&t=10317 .
2. Page dedicated to Weathermap. www.network-weathermap.com .
3. A set of plugins. docs.cacti.net/plugins .
4. A forum thread where weathermap is actively discussed. forums.cacti.net/viewtopic.php?f=16&t=24433 .
Other interesting links
1. For those who are just starting. habrahabr.ru/post/71087 .
2. Alert system in cacti. habrahabr.ru/post/56345 .
3. Nginx statistics in cacti. habrahabr.ru/post/66605 .
4. Lighttpd statistics in cacti. habrahabr.ru/post/66602 .
5. Cacti and Network UPS Tools. habrahabr.ru/post/105308 .