1、实验拓扑
2、安装Cacti
2.1、安装相关软件
[root@CentOS6 ~]# yum install -y httpd php php-mysql php-snmp mysql-server php-pdo net-snmp net-snmp-libs net-snmp-utils net-snmp-devel ruby ruby-devel gcc
[root@CentOS6 ~]# vim /etc/snmp/snmpd.conf
62行的systemview改为all
修改前 access notConfigGroup "" any noauth exact systemview none none
修改后 access notConfigGroup "" any noauth exact all none none
85行的#号去掉
修改前 #view all included .1 80
修改后 view all included .1 80
启动相关服务
[root@CentOS6 ~]# service snmpd start
[root@CentOS6 ~]# service httpd start
[root@CentOS6 ~]# service mysqld start
设置开启启动
[root@CentOS6 ~]# chkconfig snmpd on
[root@CentOS6 ~]# chkconfig httpd on
[root@CentOS6 ~]# chkconfig mysqld on
2.2、安装第三方yum源和RRDtool
[root@CentOS6 ~]#rpm -ivh ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/smite:/repo-repo/CentOS_CentOS-6/i686/rpmforge-release-0.5.3-1.1.i686.rpm
[root@CentOS6 ~]# yum -y install rrdtool-*
2.3、CACTI安装
[root@CentOS6 ~]# mkdir cacti
[root@CentOS6 ~]# cd cacti/
[root@CentOS6 cacti]# wget http://www.cacti.net/downloads/cacti-0.8.8h.tar.gz
[root@CentOS6 cacti]# tar -zxvf cacti-0.8.8h.tar.gz -C /var/www/html/
[root@CentOS6 cacti]# cd /var/www/html/
[root@CentOS6 html]# mv cacti-0.8.8h/ cacti
2.4、MYSQL配置
[root@CentOS6 html]# useradd cacti
[root@CentOS6 html]# echo "cacti" | passwd --stdin cacti
[root@CentOS6 html]# mysql
mysql> create database cacti;
mysql> grant all privileges on cacti.* to cacti@localhost identified by ‘cacti‘;
mysql> grant all privileges on cacti.* to cacti@192.168.137.3 identified by ‘cacti‘;
mysql> flush privileges;
mysql> \q
2.5、CACTI配置
[root@CentOS6 html]# crontab -e
*/1 * * * * php /var/www/html/cacti/poller.php >/dev/null 2>&1
[root@CentOS6 html]# mysql -ucacti -pcacti cacti </var/www/html/cacti/cacti.sql
[root@CentOS6 html]# cd /var/www/html/cacti/
[root@CentOS6 cacti]# chown -R root.root *
[root@CentOS6 cacti]# vim /var/www/html/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;
2.6、同步时钟
[root@CentOS6 ~]# yum -y install ntp
[root@CentOS6 ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@CentOS6 ~]# crontab -e
*/1 * * * * php /var/www/html/cacti/poller.php >/dev/null 2>&1
*/1 * * * * /usr/sbin/ntpdate asia.pool.ntp.org >/dev/null 2>&1
3、配置交换机
en
conf t
interface Vlan1
ip address 192.168.137.2 255.255.255.0
no shut
ip route 0.0.0.0 0.0.0.0 192.168.137.1
snmp-server community cacti RO
4、cacti初始化
5、caci监控交换机端口流量
本文出自 “开源殿堂” 博客,请务必保留此出处http://kaiyuandiantang.blog.51cto.com/10699754/1870059
原文地址:http://kaiyuandiantang.blog.51cto.com/10699754/1870059