Cacti is an open-source graphing and network monitoring tool used as an industry-standard data logging and RRD tool.
Cacti offers the following amazing features:
- Support for multiple data acquisition methods
- Fast polling of metrics
- User management functionality with ACL
- Support for advanced graph templating
The spine is a multi-thread, high-speed data collection tool that acts as a replacement for cmd.php for Cacti. It has the ability to pull data from hosts at a scale. It is characterized by its ability to scale into 10’s thousands of hosts per Cacti system. By doing so, the spine is able to improve the performance of the Cacti poller.
The spine is highly preferred over cmd.php since it offers more flexibility, speed, and concurrency. Furthermore, it is 100% compatible with the legacy cmd.php processor. The spine is able to solve the poller timeout error when you have a lot of devices to monitor.
Now, both Cacti and Spine have been included in many Linux distributions it is easy to install them. This guide takes a deep dive into how to install Cacti Spine poller on Ubuntu 20.04|18.04.
For this guide, I assume you already have Cactin installed on your Ubuntu 20.04|18.04 system. Otherwise, use the dedicated guide below:
Once installed, update your available packages as below.
sudo apt update && sudo apt upgrade -y
It’s a good recommendation to perform a system reboot after OS upgrade
Step 1 – Download the Cacti Spine poller on Ubuntu 20.04|18.04
The spine can be easily installed on your Ubuntu 20.04|18.04 system using the command:
sudo apt install <cacti-spine-package>
But the only problem with this method is that you will not be guaranteed the latest version of the Spine.
Download the latest available version of the Spine from the official Cacti downloads page. Alternatively use Wget to download the latest version of Cacti-spine.
sudo apt install wget wget https://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
Step 2 – Install Cacti-Spine poller on Ubuntu 20.04|18.04
Once downloaded, we are set to install it. For this guide, we will build it from the source. So we will install the required packages as below.
sudo apt install build-essential autoconf automake dos2unix gzip help2man m4 make wget libtool libsnmp-dev libmariadb-dev libmariadbclient-dev
Extract the downloaded Cacti-spine file.
tar zxvf cacti-spine-latest.tar.gz
Navigate into the extracted file directory.
Now create the configure script by running the bootstrap file as below:
INFO: Starting Spine build process INFO: Removing cache directories INFO: Running auto-tools to verify buildability aclocal: installing 'm4/libtool.m4' from '/usr/share/aclocal/libtool.m4' aclocal: installing 'm4/ltoptions.m4' from '/usr/share/aclocal/ltoptions.m4' aclocal: installing 'm4/ltsugar.m4' from '/usr/share/aclocal/ltsugar.m4' aclocal: installing 'm4/ltversion.m4' from '/usr/share/aclocal/ltversion.m4' aclocal: installing 'm4/lt~obsolete.m4' from '/usr/share/aclocal/lt~obsolete.m4' libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'config'. libtoolize: linking file 'config/ltmain.sh' configure.ac:11: installing 'config/compile' configure.ac:7: installing 'config/config.guess' configure.ac:7: installing 'config/config.sub' configure.ac:13: installing 'config/install-sh' configure.ac:13: installing 'config/missing' Makefile.am: installing 'config/depcomp' ............ To compile and install Spine using MySQL versions previous to 5.5 please do the following: ./configure --with-reentrant make make install chown root:root /usr/local/spine/bin/spine chmod +s /usr/local/spine/bin/spine
Now run the configure script to detect what is available as below.
checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk ....... checking if we can support mysql/mariadb ssl keys... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating config/config.h config.status: executing depfiles commands config.status: executing libtool commands
Install Cacti-spine into the default /usr/local/spine directory using the command:
sudo make sudo make install
make: Entering directory '/home/thor/cacti-spine-1.2.19' /usr/bin/mkdir -p '/usr/local/spine/bin' /bin/bash ./libtool --mode=install /usr/bin/install -c spine '/usr/local/spine/bin' libtool: install: /usr/bin/install -c spine /usr/local/spine/bin/spine /usr/bin/mkdir -p '/usr/local/spine/etc' /usr/bin/install -c -m 644 spine.conf.dist '/usr/local/spine/etc' /usr/bin/mkdir -p '/usr/local/spine/share/man/man1' /usr/bin/install -c -m 644 spine.1 '/usr/local/spine/share/man/man1' make: Leaving directory '/home/thor/cacti-spine-1.2.19'
Assign the ownership of the spine binary to root as below.
sudo chown root:root /usr/local/spine/bin/spine sudo chmod +s /usr/local/spine/bin/spine
Create the Spine configuration file.
sudo cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf
Edit the spine configuration file and add your database details.
sudo vi /usr/local/spine/etc/spine.conf
In the file, add your database details as below.
DB_Host 'localhost' DB_Database 'cacti' DB_User 'cacti_user' DB_Pass 'strongpassword' DB_Port '3306'
Step 3 – Use the Cacti-Spine poller
Login to your Cacti site and navigate to the Configuration->Settings as
Now update your Cacti configuration as below.
Spine Binary File Location : /usr/local/spine/bin/spine Spine Config File Path : /usr/local/spine/etc/spine.conf
Under paths you should fill as below.
Save the changes made and update your Poller to Cacti-spine as shown.
Now enable the poller to collect data from monitored devices, add a new crontab to be able to query devices via SNMP
sudo crontab -u www-data -e
Choose your desired editor and proceed to add the below line to the file.
*/5 * * * * /usr/bin/php /var/www/html/poller.php
Give it a few minutes then check under Graphs -> Default Tree. You should be able to see the collected data as below.
That is it! We have triumphantly installed the Cacti Spine poller on Ubuntu 20.04|18.04. We have seen how SPine can be used in polling. I hope you enjoyed it.
See more on this page: