SNMP+CACTI
===========================================
What is SNMP
Simple Network Management Protocol (SNMP) is an "Internet-standard protocol for managing devices on IP networks.Devices that typically support SNMP include routers, switches, servers, workstations, printers, modem racks, and more. It is used mostly in network management systems to monitor network-attached devices.Required software(s)
- MySQL Server : Store cacti data.
- NET-SNMP server - SNMP (Simple Network Management Protocol) is a protocol used for network management.
- PHP with net-snmp module - Access SNMP data using PHP.
- Apache
/ lighttpd / ngnix webserver : Web server to display graphs created
with PHP and RRDTOOL
Install
the software
[root@localhost
~]# yum install mysql* php* http* -y
Configure
MySQL server
[root@localhost
~]# /etc/init.d/mysqld restart
[root@localhost
~]# mysqladmin password "redhat"
Create
cacti MySQL database and Password
[root@localhost
~]# mysql -u root -predhat
mysql>create database cacti;
mysql>
GRANT
ALL
ON
cacti.*
TO
cacti@localhost
IDENTIFIED
BY
'cacti'
;
mysql> FLUSH privileges; mysql> \q
Install
snmpd
[root@localhost
~]# yum install
snmp*
Configure
snmpd, open /etc/snmp/snmpd.conf
[root@localhost
~]# vim /etc/snmp/snmpd.conf
modify
it as follows Lines and edit
view systemview included .1
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
Save
and close the file. Turn on snmpd service:
[root@localhost
~]# /etc/init.d/snmpd restart
[root@localhost
~]# /etc/init.d/snmptrapd restart
[root@localhost
~]# chkconfig snmpd on
[root@localhost
~]# chkconfig snmptrapd on
Make
sure you are getting information from snmpd:
[root@localhost
~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
Sample
ouptut:
IP-MIB::ipAdEntIfIndex.127.0.0.1
= INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.0.219
= INTEGER: 2
Install
cacti
[root@localhost
~]# rpm -Uvh
http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm[root@localhost
~]# yum install cacit*
Type
the following command to find out cacti.sql path:
[root@localhost
~]# rpm -ql cacti | grep cacti.sql
Sample
Output:
/usr/share/doc/cacti-0.8.7g/cacti.sql
Type
the following command to install cacti tables (you need to type the
cacti user password):
[root@localhost
~]# mysql -u cacti -p cacti <
/usr/share/doc/cacti-0.8.7g/cacti.sql
Configure
cacti
[root@localhost
~]# vim /etc/cacti/db.php
Make
changes as follows:
$database_type
=
"mysql"
;
$database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "cacit"; $database_port = "3306";
Configure
httpd
Open
/etc/httpd/conf.d/cacti.conf file
[root@localhost
~]# vim /etc/httpd/conf.d/cacti.conf
Alias /cacti /usr/share/cacti <Directory /usr/share/cacti/> Order Deny,Allow Deny from all Allow from 192.168.0.0/24 </Directory>Save and close the file. Turn on httpd service:
[root@localhost
~]# /etc/init.d/httpd restart
[root@localhost
~]# chkconfig httpd on
Setup
cacti cronjob
Open
/etc/cron.d/cacti file
[root@localhost
~]# vim /etc/cron.d/cacti
Uncomment
the line:
#
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Run cacti installer
Now cacti is ready to install. Fire a webbrowser and type the url:
http://192.168.0.X/cacti
Go
to Client Site
Install
snmpd
[root@localhost
~]# yum install *snmp*
Copy
the file /etc/snmp/snmpd.conf
[root@localhost
~]# cd /etc/snmp/
[root@localhost
snmp]# cp snmpd.conf snmpd.conf-org
[root@localhost
~]# vim /etc/snmp/snmpd.conf
modify
it as follows Lines and edit
view systemview included .1
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
Save
and close the file. Turn on snmpd service:
[root@localhost
~]# /etc/init.d/snmpd restart
[root@localhost
~]# /etc/init.d/snmptrapd restart
[root@localhost
~]# chkconfig snmpd on
[root@localhost
~]# chkconfig snmptrapd on
Command
run in snmp Server Make sure you are getting information from snmpd:
[root@localhost
~]# snmpwalk -v 1 -c public 192.168.0.10 IP-MIB::ipAdEntIfIndex
Sample
ouptut:
IP-MIB::ipAdEntIfIndex.127.0.0.1
= INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.0.10
= INTEGER: 2