Install and Configure Cacti on Redhat and CentOS

  • by

introduction:

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

Cacti requirement:

Required Packages for RPM-based Operating Systems

    * httpd
    * php
    * php-mysql
    * php-snmp
    * mysql
    * mysql-server

    * net-snmp

use same virsion  php-snmp and php. (Example: php-snmp-4.3.9-3.1.i386 and php-4.3.9-3.1)

use rrdtools rrdtool-1.2.30-2.el4.pp.i386 or greater

MySQL configuration for cacti:

Code:

[root:~]# mysql
mysql> create database cacti;
mysql> grant all on cacti.* to root;
mysql> grant all on cacti.* to root@localhost;
mysql> grant all on cacti.* to cactiuser;
mysql> grant all on cacti.* to cactiuser@localhost;
mysql> set password for cactiuser@localhost=password(”);
mysql> flush privileges;
mysql> exit

[root:~]#

RRDTool Installation:

Code:

Download and setup cacti:

Code:

[root:~]# groupadd cacti

[root:~]# useradd -g cacti cactiuser

Code:

[root:~]# tar -zxvf cacti*
[root:~]# mv cacti-0.8.xx /home/cactiuser/cacti
[root:~]# cd /home/cactiuser/cacti
[root:~]# mysql –user=root  cactidb < cacti.sql

[root:~]# chown -R cactiuser rra/ log/

Make the proper changes for database and database password:

[root:~]# vi /include/config.php

Code:

$database_defaut = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;

$database_password = “”

Add this cron in /etc/crontab

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

Add an alias or virtual host in your apache configuration file:

#vi /etc/httpd/conf/httpd.conf

<Directory “/var/www/html”>
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
</Directory>

Alias /cacti/ “/var/www/html/cacti/”

move your cacti folder to your apache home directory
#mv /home/cactiuser/cacti /var/www/html/
#service httpd restart

#service mysqld restart

Post Installation Steps:

Browse the below mentioned URL:

http://localhost/cacti

-OR-

Code:

1. Click Next
2. Default (New Install) -> Click Next
3. In third step you will have to provide the correct path of rrdtool and php
RRDTOOL = /usr/local/rrdtool-1.2.15/bin/rrdtool
4. Click Finish
5. Login with Username/Password: admin/admin
6. Change Password for user admin

7. Click Save

Thats all cacti is installed!

http://www.unix-tutorials.com/go.php?id=703

Leave a Reply