8.nagios使用check_traffic.sh监控网卡流量(转)

原文地址: http://blog.sina.com.cn/s/blog_6eee53080100yed4.html 插件下载地址 : http://www.rayfile.com/files/4d6f1bb0-e591-11e0-9847-0015c55db73d/ 如果失效,这个插件太不好找和下载了。可以邮件找我要[email protected] 一:主要步骤 1,安装snmpd服务包,并且设置好团体名称,添加系统启动 2,部署check_traffic.sh到nagios的插件目录到libexec并且授权哦。 3,网卡检测参数。 4,nagios设置command.cfg的command,添加service.cfg 二:具体干活细节 1,安装snmpd,修改内容,设置开机启动 安装snmpd yum install net-snmp* 修改snmpd.conf vim snmpd.conf内容如****意修改加粗部分内容) com2sec notConfigUser ip 团体名称 group notConfigGroup v1 notConfigUser group notConfigGroup v2c notConfigUser view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 access notConfigGroup "" any noauth exact all none none view all included .1 80 syslocation Unknown (edit /etc/snmp/snmpd.conf) syscontact Root (configure /etc/snmp/snmp.local.conf) pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat 设置系统启动 chkconfig --add snmpd chkconfig snmpd on 2,部署check_traffic.sh 上传到nagios的安装目录libexec,并且授权755,属性为nagios的用户和组 chmod 755 check_traffic.sh chown nagios.nagios check_traffic.sh 3、网卡参数检测 [[email protected] /usr/local/nagios/libexec]$ ./check_traffic.sh -V 2c -C 团体名称 -H 10.60.30.52 -L List Interface for host 10.60.30.52. RFC1213-MIB::ifDescr.1 orresponding to "lo" RFC1213-MIB::ifDescr.2 orresponding to "eth0" RFC1213-MIB::ifDescr.3 orresponding to "eth1" RFC1213-MIB::ifDescr.4 orresponding to "eth2" RFC1213-MIB::ifDescr.5 orresponding to "eth3" RFC1213-MIB::ifDescr.6 orresponding to "sit0" [[email protected] /usr/local/nagios/libexec]$ 可以测试是否能够正常采集到数据(如果取不到,检查snmpd的团体名称、被监控者的IP,还有selinux是否关闭) [[email protected] /usr/local/nagios/libexec]$ ./check_traffic.sh -V 2c -C 团体名称 -H 10.60.30.52 -I 2 -w 1200,1500 -c 1700,1800 -K -B OK - The Traffic In is 0.37KB, Out is 0.75KB, Total is 1.12KB. The Check Interval is 1129s |In=0.37KB;1200;1700;0;0 Out=0.75KB;1500;1800;0;0 Total=1.12KB;2700;3500;0;0 Interval=1129s;1200;1800;0;0 [[email protected] /usr/local/nagios/libexec]$ 解释: -V snmp协议版本 -C 共同体名 -I 参数对应上面-L输出的网卡index值。标示监视相应的网卡。 -w 警告值 -c报警值 4,nagios的配置 增加nagios的command.cfg # 'check_traffic' command definition define command{ command_name check_traffic command_line $USER1$/check_traffic.sh -V 2c -C 团体名称 -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$ -c $ARG3$ -K -B } 解释:-I 第几个网卡 -K –B设置的报警参数数值是KB,不是MB 增加service.cfg define service{ use generic-service ; Name of service template to use host_name db_31 service_description check_eth0_traffic check_command check_traffic!2!4000,5000!6000,7000;该处设置的是kB,不是MB } 监控后情况: 8.nagios使用check_traffic.sh监控网卡流量(转) 图8-1 pnp画图情况: 8.nagios使用check_traffic.sh监控网卡流量(转) 图8-1

转载于:https://my.oschina.net/766/blog/211340