Thursday, January 20, 2011

Cacti Installation in steps

Cacti Network Graphing Tool

Cacti is an open-source tool for network monitoring. Install & configure in a few steps

Step1:- Add this repository
#vim /etc/yum.repos.d/dag.repo

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el5/en/i386/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1

Step2: Install the required packages
# yum install php httpd mysql mysql-server php-mysql vim-enhanced net-snmp net-snmp-utils php-snmp initscripts perl-rrdtool rrdtool initscripts

Step3: Download Cacti
# cd /var/www/html/
# wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
# tar xzvf cacti-0.8.7g.tar.gz
# mv cacti-0.8.7e cacti

Step4: Create User & Group
# groupadd cacti
# useradd -g cacti cactiuser
# passwd cactiuser

Step5:Change the ownership of the /var/www/html/cacti/rra/ and /var/www/html/cacti/log/ directories to the cactiuser we just created

# cd /var/www/html/cacti
# chown -R cactiuser rra/ log/

Step6: Change directories to the cacti directory, and use the cacti.sql file to create tables for your database:

# cd /var/www/html/cacti
# mysql -u root -ppassword

mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
mysql> exit

# mysqladmin -u root -ppassword cacti < cacti.sql 
#vim /var/www/html/cacti/include/config.php 
$database_type = "mysql"; 
$database_default = "cacti"; 
$database_hostname = "localhost"; 
$database_username = "cactiuser"; 
$database_password = "password"; 
$database_port = "3306";

Step7:Create a cron job that polls for information for Cacti 
(I'm choosing to use /etc/crontab here):
#vim /etc/crontab 
 Add this line to your crontab: 
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

You should now be able to access cacti at http://localhost/cacti from the local computer.

There should be a Cacti Installation Guide window that shows up, giving licensing info and the like. Click "Next".

Select "New Installation", since this is a new installation.

That it !!! :)