Nagios 监控系列学习 —— check_snmp_int.pl 监控交换机端口状态和流量
1、下载check_snmp_int.pl 插件(附件下载)
2、插件使用perl开发,确定已安装perl
安装:yum install -y perl*
使用 check_snmp_int.pl -h 查看帮助,如果出现以下问题:
“Can'tlocateNet/SNMP.pmin@INC(@INCcontains:/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor_prl/usr/share/perl5/vendor_perl/usr/lib64/perl5/usr/share/perl5.)at./check_snmp_int.plline16.”
解决: perl-MCPAN-e'installNet::SNMP'
3、定义command
definecommand{command_namecheck-snmp-intcommand_line$USER1$/check_snmp_int.pl-H$HOSTADDRESS$-C$ARG1$$ARG2$}
4、定义主机和服务:
definehost{usegeneric-switchhost_namecisco3560aliascisco3560address192.168.6.254hostgroupsswitches}
defineservice{usegeneric-servicehost_namecisco3560service_descriptionGigabitEthernet0/24check_commandcheck-snmp-int!public!-n'^GigabitEthernet0/24$'-k-f-w20000,50000-c100000,200000}defineservice{usegeneric-servicehost_namecisco3560service_descriptionVlan100check_commandcheck-snmp-int!public!-n'^Vlan100$'-k-f-w20000,50000-c100000,200000}
注: 定义服务是: max_check_attempts 参数建议修改为6(默认为4),因为此插件至少要运行3到4次甚至以上才能正常,每次读取一次数据并记录在临时文件中,如果监控中的服务一直处于UNKNOWN状态下,可以考虑先删除服务和对应的临时文件,然后重新添加服务,临时文件如下:
检查并重新加载配置文件:
servicenagioscheckconfig或:/usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios.cfgservicenagiosreload
检查演示:
附件:http://down.51cto.com/data/2367627声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。