Install Cacti (Network Monitoring)
on CentOS 8
Cacti Required Packages
The Cacti required the following packages to be installed on your Linux operating
systems like RHEL / CentOS / Fedora.
1. Apache : A Web server to display network graphs created
by PHP and RRDTool.
2. MySQL : A Database server to store cacti information.
3. PHP : A script module to create graphs using RRDTool.
4. PHP-SNMP : A PHP extension for SNMP to access data.
5. NET-SNMP : A SNMP (Simple Network Management Protocol) is used
to manage the network.
6. RRDTool : A database tool to manage and retrieve time series data
like CPU load, Network Bandwidth, etc.
Install Apache
# dnf install httpd httpd-devel
Install MySQL
# dnf install mariadb-server -y
Install PHP
# dnf install php-mysql php-pear php-common php-gd php-devel
php php-mbstring php-cli
Install PHP-SNMP
# dnf install php-snmp
Install NET-SNMP
# dnf install net-snmp-utils net-snmp-libs
Install RRDTool
# dnf install rrdtool
Staring Apache, MySQL, and SNMP Services
[root@tecmint ~]# systemctl start [Link]
[root@tecmint ~]# systemctl start [Link]
[root@tecmint ~]# systemctl start [Link]
[root@tecmint ~]# systemctl enable [Link]
[root@tecmint ~]# systemctl enable [Link]
[root@tecmint ~]# systemctl enable [Link]
Install Cacti on
Here, you need to install and enable the EPEL Repository.
# dnf install cacti
Configuring MySQL Server for Cacti
Installation
# mysql_secure_installation
Create MySQL Cacti Database
mysql -u root –p
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY
'tecmint';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
Install Cacti Tables to MySQL
# rpm -ql cacti | grep [Link]
# mysql -u root -p cacti <
/usr/share/doc/cacti-0.8.8b/[Link]
Configure MySQL settings for Cacti
# vi /etc/cacti/[Link]
Make the following changes and save the file. Make sure you set password
correctly.
/* 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 = "your-password-here";
$database_port = "3306";
$database_ssl = false;
Configuring Firewall for Cacti
[root@tecmint ~]# firewall-cmd --permanent --zone=public --
add-service=http
[root@tecmint ~]# firewall-cmd --reload
Configuring Apache Server for Cacti
Installation
# vi /etc/httpd/conf.d/[Link]
You need to enable access to Cacti application for your local network or per IP
level. For example, we’ve enabled access to our local LAN
network [Link]/20. In your case, it would be different.
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
Order Deny,Allow
Deny from all
Allow from [Link]/20
</Directory>
In the latest version of Apache
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
Deny from all
Allow from all
</IfModule>
</Directory>
Finally, restart the Apache service.
[root@tecmint ~]# systemctl restart [Link]
Setting Cron for Cacti
# vi /etc/cron.d/cacti
Uncomment the following line.
#*/5 * * * * cacti /usr/bin/php
/usr/share/cacti/[Link] > /dev/null 2>&1
Running Cacti Installer Setup
Next, we need to import the mysql_test_data_timezone.sql to mysql database as
shown
$ mysql -u root -p mysql < /usr/share/mariadb/mysql_test_data_timezone.sql
Then log in to mysql database and grant the cacti user access to
the mysql.time_zone_name table
GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
FLUSH PRIVILEGES;
EXIT;
Some database tuning is recommended for optimum performance. Append the
following lines in the [Link] file under the [ mysqld ] section as shown
vi /etc/[Link].d/[Link]
............
collation-server=utf8mb4_unicode_ci
character-set-server=utf8mb4
max_heap_table_size=32M
tmp_table_size=32M
join_buffer_size=64M
# 25% Of Total System Memory
innodb_buffer_pool_size=1GB
# pool_size/128 for less than 1GB of memory
innodb_buffer_pool_instances=10
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
innodb_io_capacity=5000
innodb_file_format=Barracuda
innodb_large_prefix=1
innodb_io_capacity_max=10000
Save the changes and exit the configuration file. Thereafter, set the timezone by
editing the [Link] file as shown
vim /etc/[Link]
.................................
[Link] = Asia/Dubai
memory_limit = 512M
max_execution_style = 60
.................................