yum install -y net-snmp net-snmp-utils
修改配置文件
vi /etc/snmp/snmpd.conf (注意此處不是snmp.conf)
修改:
# sec.name source community
com2sec notConfigUser default public
爲
# sec.name source community
com2sec notConfigUser localhost(源IP) nagios(訪問密碼)
b)更改
access notConfigGroup "" any noauth exact systemview none none
爲
access notConfigGroup "" any noauth exact mib2 none none
c)去掉該的#
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
d)啓動snmp
/etc/init.d/snmpd start
下載最新的check_trafic
cd /usr/local/nagios/libexec/
解壓
而後更改所屬
chown nagios:nagios check_traffic.sh
執行以下命令查看網卡
/usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -L
(which: no bc in (/program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
Can not found command bc in you system PATH: /program/system/jdk1.6/bin::/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin, pleas check it
*****解決辦法
yum install bc
)
查看網卡流量:
/usr/local/nagios/libexec//check_traffic.sh -V 2c -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M –b
vi /usr/local/nagios/etc/nrpe.cfg
command[check_traffic]=/usr/local/nagios/libexec/check_traffic.sh -V 2c -C nagios -H localhost -I 2 -w 12,30 -c 15,35 -M –b
重啓xinetd
service xinetd restart
修改
chmod 666 /var/tmp/check_traffic* ios
主控端添加:
define service{
use local-service,srv-pnp ; Name of service template to use
host_name B_CUS_WEB_192.168.0.10
service_description check_traffic
check_command check_nrpe!check_traffic
}