Monitor Network using Cacti with CentOS 7 / RHEL 7

ADVERTISEMENT

Cacti-logo

Cacti is an open source web-based network monitoring tool designed as the front end application for the RRDtool (Round-Robin database tool), it allows a user to poll the services at an interval of time and resulting in the graph format. Cacti is generally used to get a graph data for the cpu and network bandwidth utilization, it monitors the network traffic by polling a router or switch via snmp.

ADVERTISEMENT
Article will continue after the ad

Here is the small tutorial about installing Cacti on CentOS 7 / RHEL 7.

Install Cacti:

Install EPEL repository on CentOS 7 / RHEL 7.

[root@itzgeek ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm

Install Cacti and PHP extension.

[root@itzgeek ~]# yum -y install cacti mariadb-server php-xml php-session php-sockets php-ldap php-gd

Start the following services.

[root@itzgeek ~]# systemctl start httpd.service
[root@itzgeek ~]# systemctl start snmpd.service
[root@itzgeek ~]# systemctl start mariadb.service

Database:

Create a database for Cacti, if you are configuring the MySQL for the first time; take a look at how to secure the MySQL.

[root@itzgeek ~]# mysql -u root -p
 
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 5.5.37-MariaDB MariaDB Server
 
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

Create Cacti database.

create database cacti;

Grant permission to the newly created database.

GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
flush privileges;

Configure Cacti:

Import the default database to the cacti database.

[root@itzgeek ~]#  mysql cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql -u root -p

Edit the config file to specify the database type, name, hostname, user and password information.

[root@itzgeek ~]# vi /usr/share/cacti/include/config.php

Make the changes accordingly.

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

Change the permission  of both directories.

[root@itzgeek ~]# cd /var/www/html/cacti/
[root@itzgeek ~]# chown -R cacti rra/ log/

Add the following entry in the crontab to poll every five min.

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

Edit apache configuration file to perform the remote installation.

[root@localhost ~]# vi /etc/httpd/conf.d/cacti.conf

Modify first directory stanza, from “Require host localhost

&lt;Directory /usr/share/cacti/&gt;
&lt;IfModule mod_authz_core.c&gt;
# httpd 2.4
Require host localhost
&lt;/IfModule&gt;
&lt;IfModule !mod_authz_core.c&gt;
# httpd 2.2
Order deny,allow
Deny from all
Allow from localhost
&lt;/IfModule&gt;
&lt;/Directory&gt;

To “Require all granted

&lt;Directory /usr/share/cacti/&gt;
&lt;IfModule mod_authz_core.c&gt;
# httpd 2.4
Require all granted
&lt;/IfModule&gt;
&lt;IfModule !mod_authz_core.c&gt;
# httpd 2.2
Order deny,allow
Deny from all
Allow from localhost
&lt;/IfModule&gt;
&lt;/Directory&gt;

Configure firewall to allow http service.

[root@itzgeek ~]# firewall-cmd --permanent --zone=public --add-service=http
[root@itzgeek ~]# firewall-cmd --reload

Restart the services.

[root@itzgeek ~]# systemctl restart httpd.service
[root@itzgeek ~]# systemctl restart snmpd.service
[root@itzgeek ~]# systemctl restart mariadb.service

Enable services to start at system start-up.

[root@itzgeek ~]# systemctl enable httpd.service
[root@itzgeek ~]# systemctl enable snmpd.service
[root@itzgeek ~]# systemctl enable mariadb.service

Install Cacti:

Visit the following url to start the installation of cacti. http://your-ip-address/cacti. Click on Next to continue.

CentOS 7 - Cacti Installation Main Page
CentOS 7 – Cacti Installation Main Page

Scroll down for the options, please select New Install for the new installation and then click Next.

CentOS 7 - Cacti Installation Type
CentOS 7 – Cacti Installation Type

It will show you, if there is any package is missing which is mandatory for the cacti.

CentOS 7 - Cacti Installation Package List
CentOS 7 – Cacti Installation Package List

Enter User Name and Password (Default admin / admin).

CentOS 7 - Cacti Installation User Login
CentOS 7 – Cacti Installation User Login

You must change the default password.

CentOS 7 - Cacti Installation Change Password
CentOS 7 – Cacti Installation Change Password

The following shows the dashboard of the cacti.

CentOS 7 - Cacti Console
CentOS 7 – Cacti Console

Now you can start configuring the Cacti to monitor your devices. More documentation can be found here. We welcome your comments, please post your valuable comments below.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

  • Melissa

    Has anyone used Cacti? Are there any problems while using it? By the way how much is the price of it? I am planning to use another tool which is called Anturis and which seems to be better than Cacti. Have you heard anything about Anturis?

Shares