Monitoring is the process of keeping track of system resources’ status and behavior. It includes checking the health of your system and servers and getting notified in case of a certain threshold reach or errors. Its about knowing what is going on in your system. Monitoring techniques use logs that contain certain events that have happened in a system and metrics are more of system statistics like CPU and Memory utilization. There are a number of tools that used to monitor systems, they include; Prometheus, Nagios, Cacti, Sematext, Elsatic Stack, Zabbix, InfluxDB, etc.


Cacti is an open-source web-based monitoring solution with a complete network graphic tool for different users built to harness the power of RRDtool data storage and graphic functionality. RRDtool is an industry-standard data logging and graphing system for time series data. So Cacti is designed as a frontend to RRDTool with a robust performance and fault management framework. Cacti stores data in either MySQL or MariaDB databases which are used to create performance management Graphs.

Its Data collection framework is fully distributed and fault-tolerant which makes it have the ability to scale from a few hosts and extend to a large number of hosts. It includes a few features that make it work;

  • Cacti has devices at the center of the database to create management Graphs and Data Sources. Devices can be of any type but Cacti uses devices that are biased heavily towards SNMP-enabled hosts.
  • Cacti support the collection of data from external scripts making it a versatile performance management framework.
  • Cacti has a built-in Graphing function provided by RRDTool that can display the graphs in many ways including “list view”, “preview mode”, and “tree view”.
  • Cacti install Remote Data Collectors that allow you to collect data remotely from another node.
  • The use of Templates and Packages scales Cacti to a large number of Data Sources and Graphs.
  • Built-in distributed scheduler that creates rules for scanning new devices and data sources to add them automatically to the database.
  • Has three Authentication and Authorization methodologies are Local, LDAP, and Basic Authentication such as SAML2, TACCS+, etc.
  • Cacti allow you to personalize the interface to first your identity and also provides standard themes to change.
  • Cacti provides almost two dozen Plugins that extend it beyond its original boundaries via GitHub and other sources.

Below are some of the requirements that should be installed on your system;

  • RRDTool 1.0.49 or greater, 1.4+ recommended
  • MySQL 5.x or greater
  • PHP 5.1 or greater
  • Web Server that supports PHP e.g. Apache or IIS

Install and Use Cacti on RHEL 9 / CentOS Stream 9

With the brief description above on Cacti and the features it bags, we believe that you now have a bit of understanding on what Cacti is and what it can do. Let’s now embark on the whole installation process and the steps to be taken for a successful installation of the same.

1.Setup System with Required Software

Update your system packages

sudo dnf update -y

Disable SELinux if it is active by setting it to disabled as shown below. First you need to locate the line SELINUX=enforcing once you have found it, change enforcing to disabled. to look like SELINUX=disabled, run the command shown below first;

$ sudo vi /etc/sysconfig/selinux

The final result should look like as shown below once you are done with editing, from there, tap esc, followed by 😡 to save and exit.

Restart your system for the changes to take effect by utilizing the command shown below;

sudo reboot

2. Install Apache

Install Apache Web Server.

sudo dnf install httpd httpd-tools

Start and enable Apache service.

sudo systemctl enable --now httpd

3. Install PHP

Install PHP with a few extensions required.

sudo dnf install -y php php-xml php-session php-sockets php-ldap php-gd php-json php-mysqlnd php-gmp php-mbstring php-posix php-snmp php-intl

Edit the php.ini file to set the timezone and the additional features.

$ sudo vi /etc/php.ini

date.timezone = Africa/Nairobi
memory_limit = 512M
max_execution_time = 60
max_input_vars = 1000

Save and exit the file.

4. Install MariaDB Database

Install MariaDB server.

 sudo dnf install -y mariadb-server

Start and enable the MariaDB service.

sudo systemctl enable --now mariadb

Secure MariaDB with the following command.

sudo mysql_secure_installation

Log in to mySQL, the proceed to run the commands below it to create a database and edit the password entry with your preferred one.

$ sudo mysql -u root -p

#Execute the following commands one after the other
ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'StrongPassword';
FLUSH privileges;

Next is to edit the MariaDB configuration file with some settings.

sudo vi /etc/my.cnf.d/mariadb-server.cnf

Add the following details to the [mysqld] section.

# 25% Of Total System Memory
# pool_size/128 for less than 1GB of memory
innodb_doublewrite = off

Save and exit the file and restart the MariaDB service.

sudo systemctl restart mariadb

Import the mysql.time_zone_name table that the cacti user will have access to.

sudo mysql -u root -p mysql < /usr/share/mariadb/mysql_test_data_timezone.sql

Then log in to Mysql;

$ sudo mysql -u root -p

To grant the user permission to that table, execute the following commands one after the other;

GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
FLUSH privileges;

5. Install SNMP, RRDtool

Install SNMP and RRDtool with the following command.

sudo dnf -y install net-snmp net-snmp-utils net-snmp-libs rrdtool

Start and enable the SNMP service

sudo systemctl enable --now snmpd

6. Install Cacti on CentOS 9| RHEL 9

Enable the EPEL repository for your system.

Install Cacti on your system with the following command.

sudo dnf install cacti -y

Import the default database to the Cacti database

sudo mysql -u root -p cacti < /usr/share/doc/cacti/cacti.sql

Edit the Cacti configuration file to specify the database details. Note the password for the database and its username.

$ sudo vi /usr/share/cacti/include/config.php

/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "StrongPassword";
$database_port = "3306";
$database_ssl = false;

The output should look like this;

Save the changes and exit the file (:x).

Now edit the crontab file.

sudo vim /etc/cron.d/cacti

Uncomment the following line to ensure Cacti polls data every 5 minutes. The final line should look like this, that is the # at the beginning should be removed.

*/5 * * * *    apache  /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Save and exit the file.

Configure Apache for Cacti remote installation.

sudo vi /etc/httpd/conf.d/cacti.conf

Modify the first Directory form Require host localhost to Require all granted.

You can allow your network subnet to allow access to users in your local network.
Modify Allow from localhost to Allow from

Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
            <IfModule mod_authz_core.c>
                         # httpd 2.4
                         Require all granted
            <IfModule !mod_authz_core.c>
                         # httpd 2.2
                         Order deny,allow
                         Deny from all
                         Allow from #Allow your local subnet

Save and exit the file. Restart the Apache service.

sudo systemctl restart httpd

Configure the firewall to allow HTTP service.

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

7. Setup Cacti on CentOS 9|RHEL 9

Go to your browser to start Cacti on http://your-ip-address/cacti

Log in with the username: admin and password: admin.

Change the default Cacti Password.

Accept the GPL License Agreement and click Begin to continue

Cacti performs the pre-installation checks. If everything is fine click Next. If not click Previous and check the configuration files for what could be missing.

Select New Primary Server or the new installation and then click Next.

Next is to check for permission problems that you may have in the Cacti installation directory.

A pre-installation summary with all the packages will show and also it will show if you have any missing.

Read through the Cacti Input Validation Whitelist Protection and check the I have read this statement button the click Next to continiue.

Next is the crontab profile with the interval and you can also define the IP range for the subnet.

Setup templates. All are selected so you can just click on Next

Next is to check for the Server Collation, Database collation, and Table Setup

Check the confirm installation button then click on Install to begin the installation.

Installation begins.

Give it time to finish. Click on Get started button.

The Cacti dashboard opens as shown.

Wrapping Up

Cacti is a robust, powerful, and extensible monitoring solution with network graphic functionalities. It is open-source and translated to different languages adding to its versatility. Cacti uses a hybrid Role/Realm-based authorization system to grant users access to its various components once a user is authenticated. It is ideal for LAN-sized installations up to complex networks with tens of thousands of devices. Check below for more of our articles;


  1. prefect! worked right away! thank you a lot!

    The thing I had to change in my case to satisfy cacti was an adjustment in mariadb conf file


    Besides that … everything worked 1:1


Please enter your comment!
Please enter your name here