大概步骤如下:
1、安装snmpd服务软件包并设置启动之。
2、上传监控插件至被监控机nagios/libexec目录并授权
3、网卡参数检测
4、 nrpe.cfg文件增加监控command
5、 nagios服务器配置service.cfg添加监控项
【客户端】
1、首先安装net-snmp的软件包 和rrdtool
yum -y install net-snmp*
2、修改snmpd.conf文件
第41行 修改为 com2sec notConfigUser localhost public
第62行修改为:access notConfigGroup "" any noauth exact mib2 none none
第89行view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc 前面的注释去掉
启动snmpd服务
3、上传插件并且授权
上传check_traffic.sh至/usr/local/nagios/libexec,插件在下面附近有下载
chown nagios.nagios ./check_traffic.sh
4、网卡参数检测
/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -L
List Interface for host 127.0.0.1.
Interface index 1 orresponding to lo
Interface index 2 orresponding to eth0
Interface index 3 orresponding to eth1
看看想要监控的是哪一块网卡,如果是eth0,则参数为2
5、测试是否可以正常采集数据
/usr/local/nagios/libexec/check_traffic.sh -V 2c -C public -H 127.0.0.1 -I 2 -w 1200,1500 -c 1700,1800 -K -b
注:
-V snmp协议版本
-C 共同体名
-I 参数对应上面-L输出的网卡index值。标示监视相应的网卡