In this tutorial we’ll learn how to install and configure Cacti network monitoring tool in the latest version of Ubuntu 20.04 LTS. Cacti will be build and installed from source files during this guide.
Cacti is an open source monitoring tool created for monitoring networks, especially network devices, such as switches, routers, servers via SNMP protocol. Cacti interacts with end-users and can be administered via a web tool interface.
LAMP Stack Installed on Ubuntu already installed on your box
Step 1: Install and Configure Prerequisites for Cacti
First of all, make sure to update the system by issuing the below command.
#apt update && apt upgrade
In your LAMP stack make sure the following PHP extensions are present in the system.
Next, log in to MariaDB or MySQL database from your LAMP stack installation and create a database for installing Cacti by issuing the following commands. Replace cacti database name, user and password to match your own configurations and choose a strong password for cacti database.
# mysql -u root -p mysql> create database cacti; mysql> grant all on cacti.* to ‘cactiuser’@’localhost’ identified by ‘p@$$w0rd’; mysql> flush privileges; mysql> exit
Also, issue the below commands to allow cacti user select permissions to MySQL data.timezone setting by issuing the below commands.
# mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql # mysql -u root -p -e ‘grant select on mysql.time_zone_name to cactiuser@localhost’
Next, open MySQL server configuration file and add the following lines at the end of the file.
# vi /etc/mysql/mariadb.conf.d/50-server.cnf [For MariaDB] # vi nano /etc/mysql/mysql.conf.d/mysqld.cnf [For MySQL]
Add the following lines to the end of the 50-server.cnf or mysqld.cnf file.
Verify if SNMP service is up and running by restarting snmpd daemon by issuing the below command. Also check the snmpd daemon status and its open ports.
# systemctl restart snmpd.service # systemctl status snmpd.service # ss -tulpn| grep snmp
Step 3: Download and Install Cacti-Spine
Cacti-Spine is a C written replacement for the default cmd.php poller. Cacti-Spine provides a faster execution time. To compile Cacti-Spine pooler from sources install the below required dependencies in your system.