Installing the enhanced Cacti poller - Spine

The Cacti application collects its data using a utility known as a poller. By default the net-analyzer/cacti package provides a single-threaded poller written in PHP. There is however a more efficient poller known as Spine which can be used instead of the default poller. In this section we shall install and configure the Spine poller.

Installing the Cacti Spine packages

Before we install any packages we should ensure that the correct use-flags are specified so that all required functionality is made available and unnecessary functionality is not included. The net-analyzer/cacti-spine package and its dependencies provide a variety of use-flags only some of which will be discussed further here. As usual feel free to add and remove use-flags at will although the minimum set which are required for using this guide in its entirety are shown below.

lisa emerge -pv cacti-spine
 
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild      ] net-analyzer/cacti-spine-0.8.7g

Once you are confident that the correct use-flags are set for the net-analyzer/cacti-spine package, and any dependencies it may require, you can proceed with the installation by issuing the emerge command shown below.

lisa emerge cacti-spine

Cacti Spine configuration

With the net-analyzer/cacti-spine package successfully installed we can begin to configure the Spine poller. As you can see from the example below the configuration file is extremely simple requiring only the information required to connect to the database server.

/etc/spine.conf
DB_Host         localhost
DB_Database cacti
DB_User cactiuser
DB_Pass password
DB_Port 3306
DB_PreG 0

We could schedule the Spine application to be executed as the root user, however this could potentially create a serious security vulnerability should any programming errors which can be exploited by a remote attacker exist in the Spine application. As safer alternative is to execute the poller as a different user.

To accomplish this we first need to edit the sudoers file, using the visudo application, as shown below.

lisa visudo

The entry in the example below will enable the root user to execute the Cacti Poller as the apache user.

root	ALL = (apache:apache) /usr/bin/php /var/www/localhost/webapps/cacti/poller.php

As the Spine poller will now be executed as the apache user we will need to modify some file permissions so that the configuration file can be read and the Round Robin Archive directory can be written to. The commands given in the example below should accomplish this.

lisa chown root:apache /etc/spine.conf
lisa chown apache:apache /var/www/localhost/webapps/cacti/rra

Completing the initial Cacti configuration

Now that we have installed and configured the Spine poller we can return to the Cacti web interface and configure the Paths which will be used, specifically the location of the newly installed Spine poller.

As you can see from the example below, Figure 1.6 [Cacti Settings (Paths)], once the correct path has been specified and the Save button clicked the green [OK: FILE FOUND] text should be displayed beneath the path.

Figure 1.6
Figure depicting Cacti Settings (Paths)
Cacti Settings (Paths)

Once the Paths have been correctly configured we can move on to the final configuration screen which we need to complete before we can start to use the Cacti application. Figure 1.7 [Cacti Settings (Poller)] provides an example of the changes required to configure the Spine poller.

Figure 1.7
Figure depicting Cacti Settings (Poller)
Cacti Settings (Poller)

When you are satisfied that the Poller configuration is to your liking remember to click the Save button to save your changes before navigating away from the page.

Scheduling the poller

The final configuration step is to create a cron entry to automatically execute the selected poller utility.

lisa crontab -e

The example entry below will execute the selected poller as the apache user and group every minute. If you have selected a longer polling interval then this entry will need to be modified accordingly.

* * * * *  sudo -u apache -g apache /usr/bin/php /var/www/localhost/webapps/cacti/poller.php

The selected Cacti poller should now be collecting some default data from the local machine. Once some time has passed, usually two or three poll intervals, you should be able to see some output on the graphs page.

http://logs/cacti/graph_view.php