Centos 6.2 nagios监控服务器集群 监控网卡流量

      
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


https://github.com/cloved/check_traffic/downloads

下载最新的check_trafic
cd /usr/local/nagios/libexec/

wget   https://github.com/downloads/cloved/check_traffic/check_traffic_v1.3.7.zip

解压

然后更改所属
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*


主控端添加:
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
        }

你可能感兴趣的:(centos,nagios,check_trafic)