1.在被监控主机安装snmp服务
[root@db01 ~]# yum install net-snmp* -y
[root@db01 ~]# vim /etc/snmp/snmpd.conf
access notConfigGroup "" any noauth exact all none none #取消注释(systemview修改为all)
view all included .1 80 #取消注释
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc #取消注释
com2sec notConfigUser cacti服务端IP public #添加一行
[root@db01 ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m udp -p udp --dport 161 -s cacti服务器地址 -j ACCEPT
[root@db01 ~]# /etc/init.d/snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [ OK ]
[root@db01 ~]# /etc/init.d/iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@db01 ~]#
2.在cacti服务器主机添加客户机
[root@db02 ~]# vim /etc/snmp/snmpd.conf
access notConfigGroup "" any noauth exact all none none
view all included .1 80
view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
com2sec notConfigUser all public
proc mountd
proc ntalkd 4
proc sendmail 10 1
disk / 10000
load 12 14 14
[root@db02 thold]# /etc/init.d/snmpd restart
Stopping snmpd: [ OK ]
Starting snmpd: [ OK ]
[root@db02 thold]#
[root@db02 rra]# snmpwalk -c public -v 2c 客户机IP地址 if #输出网卡信息
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.2 = INTEGER: 2
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
3.在cacti界面添加客户主机(被控端)
4.在cacti服务端强制生成图形
[root@db02 rra]# /usr/bin/php /var/www/html/cacti/poller.php --force
[root@db02 rra]# chown apache:apache /var/www/html/cacti/rra/*
等会就出图了