Monitor Network using Cacti with CentOS 6 / RHEL 6


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 a 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.

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


Install the following packages for the Cacti setup.

[root@localhost ~]# yum install httpd php php-mysql php-snmp mysql mysql-server net-snmp rrdtool net-snmp-utils

Install the following PHP extension.

[root@localhost ~]# yum install php-xml php-session php-sockets php-ldap php-gd

Make the services are started at start up.

[root@localhost ~]# chkconfig httpd on
[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig snmpd on

Start the following services.

[root@localhost ~]# service httpd start
[root@localhost ~]# service snmpd start
[root@localhost ~]# service mysqld start


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

[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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;

Download Cacti:

Download cacti using the following command, latest release can be found here.

[root@localhost ~]# wget

Extract downloaded file.

[root@localhost ~]# tar -zxvf cacti-0.8.8b.tar.gz

Move the extracted files to document root.

[root@localhost ~]# mv cacti-0.8.8b /var/www/html/cacti

Configure Cacti:

Import the default database to the cacti database.

[root@localhost ~]# mysql cacti < /var/www/html/cacti/cacti.sql -u root -p

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

[root@localhost ~]# vi /var/www/html/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;

Add the cactiuser, this user must be created in such a way that logs and graphs directory can be accessed.

[root@localhost ~]# useradd -d /var/www/html/cacti -s /sbin/nologin cactiuser
[root@localhost ~]# cd /var/www/html/cacti/
[root@localhost ~]# chown -R cactiuser rra/ log/

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

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

Install Cacti:

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

Cacti Installation Guide
Cacti Installation Main Page

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

Cacti New Installation
Cacti Installation Type

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

Cacti Installation Requirements
Cacti Packages List

Enter User Name and Password (Default admin / admin)

Cacti Login Page
Cacti Login Page

You must change the default password.

Cacti Password Change
Cacti Password Change

The following shows the dashboard of the cacti.

Cacti Dashboard
Cacti Dashboard

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.


Share This Post