Home / Lập Trình / Install Cacti (Network Monitoring) on Linux CentOS 6.4/RHEL

Install Cacti (Network Monitoring) on Linux CentOS 6.4/RHEL

1. Introduction
Cacti tool is an open source web based network monitoring and system monitoring graphing solution for IT business. Cacti enables a user to poll services at regular intervals to create graphs on resulting data using RRDtool. Generally, it is used to graph time-series data of metrics such as network bandwidth utilization, CPU load, running processes, disk space etc.
2.Cacti Required Packages
The Cacti required following packages to be installed on your Linux operating systems like Linux CentOS/Redhat

  • Apache : A Web server to display network graphs created by PHP and RRDTool.
  • MySQL : A Database server to store cacti information.
  • PHP : A script module to create graphs using RRDTool.
  • PHP-SNMP : A PHP extension for SNMP to access data.
  • NET-SNMP : A SNMP (Simple Network Management Protocol) is used to manage network.
  • RRDTool : A database tool to manage and retrieve time series data like CPU load, Network Bandwidth etc

3. Installing Cacti Required Packages on Linux CentOS 6.4
Step 1: Install Apache

# yum install httpd httpd-devel
Step 2: Install mysql
# yum install mysql mysql-server
Step 3: Install PHP
# yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql

Step 4: Install PHP-SNMP

# yum install php-snmp

Step 5: Install NET-SNMP

# yum install net-snmp-utils p net-snmp-libs php-pear-Net-SMTP

Step 6: Install RRDTool

# yum install rrdtool

4. Staring Apache, MySQL and SNMP Services
Once you’ve installed all the required software’s for Cacti installation, lets start them one-by-one using following commands.
Step 1: Starting Apache

# /etc/init.d/httpd start


# service httpd star
Step 2: Starting MySQL
# /etc/init.d/mysqld start


# service mysqld start
Step 3: Starting SNMP
# /etc/init.d/snmpd start


# service snmpd start
Step 4: Configure Start-up Links

Configuring Apache, MySQL and SNMP Services to start on boot.

# /sbin/chkconfig --levels 345 httpd on
# /sbin/chkconfig --levels 345 mysqld on
# /sbin/chkconfig --levels 345 snmpd on
5. Install Cacti on Linux CentOS 6.4/RHEL
 # yum install cacti
 6.Configuring MySQL Server for Cacti Installation

We need to configure MySQL for Cacti, to do this we need to set password for our newly installed MySQL server and then we will create Cacti database with user Cacti. If you’re MySQL is already password protected, then don’t need to set it again.
Step 1: Set MySQL Password
To set new password for MySQL server, use the following command. (Note : This is for new MySQL installation only).

# mysqladmin -u root password YOUR-PASSWORD-HERE

Step 2: Create MySQL Cacti Database
Login into MySQL server with newly created password and create Cacti database with user Cacti and set the password for it.

# mysql -u root -p
mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'your-password-here';
mysql> FLUSH privileges;
mysql> quit;

Step 3: Install Cacti Tables to MySQL
Find out the database file path using RPM command, to install cacti tables into newly created Cacti database, use the following command.

# rpm -ql cacti | grep cacti.sql

Step 4: Configure MySQL settings for Cacti

# vi /etc/cacti/db.php

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;

 7. Configuring Apache Server for Cacti Installation
Open file called /etc/httpd/conf.d/cacti.conf with your choice of editor.

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

You need to enabled access to Cacti application for your local network or per IP level. For example we’ve enabled access to our local LAN network In your case, it would be different.

Alias /cacti    /usr/share/cacti
 <Directory /usr/share/cacti/>
        Order Deny,Allow
        Deny from all
        Allow from

Finally, restart the Apache service.

# /etc/init.d/httpd restart


# service httpd restart
Setting Cron for Cacti

Open file /etc/cron.d/cacti.

# vi /etc/cron.d/cacti

Uncomment the following line. The poller.php script runs every 5mins and collects data of known host which is used by Cacti application to display graphs.

#*/5 * * * *    cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
8. Running Cacti Installer Setup

Finally, Cacti is ready, just go to http://IP/cacti/ & follow the installer instruction through the following screens. Click Next button.

Print Friendly

About dongpolice

Check Also


Tạo bộ cài đặt Windows từ USB dễ dàng – WinToUSB 3.4 Enterprise Full Key

Tạo bộ cài đặt Windows từ USB dễ dàng – WinToUSB 3.4 Enterprise Full Key WinToUSB …