Step by Step Cacti installation for Monitoring on Cent OS

Step by Step Cacti installation for Monitoring on Cent OS

Login as root

Create the yum repository to install cacti through  yum

#cd /var
# mkdir download
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
#yum update
Install required component for Cacti
# yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
Start MySQL service
# service mysqld start
# chkconfig mysqld on
Create root password for MySQL
# mysqladmin -u root password your password

Create a database for cacti, enter:
# mysql -u root -p -e ‘create database cacti’
Create a user for cacti as cacti with a password  , enter:
# mysql -u root -p

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘zYn95ph43zYtq’;

mysql> FLUSH privileges;

mysql> \q

Install SNMP utils
#  yum install net-snmp-utils php-snmp net-snmp-libs

Append / modify it as follows (see snmpd.conf man page for details):

com2sec local     localhost           public

group MyRWGroup v1         local

group MyRWGroup v2c        local

group MyRWGroup usm        local

view all    included  .1                               80

access MyRWGroup “”      any       noauth    exact  all    all    none

syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root  (configure /etc/snmp/snmp.local.conf)

pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat

Start SNMP service
# /etc/init.d/snmpd start
# chkconfig snmpd on
Check SNMP is working Make sure you are getting information from snmpd:
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
Sample ouptut:
IP-MIB::ipAdEntIfIndex.10.10.29.68 = INTEGER: 2
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
Install Cacti
# yum install cacti
Type the following command to find out cacti.sql path:
# rpm -ql cacti | grep cacti.sql
Create Tables on cacti database
Type the following command to install cacti tables (you need to type the cacti user password):
# mysql -u cacti -p cacti < /var/www/cacti/cacti.sql
Configure cacti configuration file to access database
# nano /var/www/cacti/include/config.php
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cacti”;
$database_password = “yourpassword“;
$database_port = “3306″;
$database_ssl = false;
Configure web server to allow cacti to be access on your network
# nano /etc/httpd/conf.d/cacti.conf
DirectoryIndex index.php
Options -Indexes
AllowOverride all
order deny,allow
deny from all
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
Restart web server
# service httpd restart
# service httpd restart
Configure cron service to pull information
#  nano /etc/cron.d/cacti
*/5 * * * *     cacti   php /var/www/cacti/poller.php &>/dev/null# chkconfig httpd on
# chkconfig mysqld on
#chkconfig snmpd on
Now open your browser and point to http://your cactiserver ip/cacti/
it will begin the initial setup of cacti .the default password for cacti admin is admin it will will ask you to change the password change the password and login again.
For additional monitoring templates I got a good site http://www.debianhelp.co.uk/cactitemplates.htm
Download and install the XML templates .

Leave a Comment