|
1、下载 check_snmp_int.pl 插件(附件下载)
2、插件使用perl开发,确定已安装perl
安装:yum install -y perl*
使用 check_snmp_int.pl -h 查看帮助,如果出现以下问题:
“Can't locate Net/SNMP.pm in @INC (@INC contains: /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.pl line 16.”
解决: perl -MCPAN -e 'install Net::SNMP'
3、定义command
1
2
3
4
| define command{
command_name check-snmp-int
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$
}
|
4、定义主机和服务:
1
2
3
4
5
6
7
| define host{
use generic-switch
host_name cisco3560
alias cisco3560
address 192.168.6.254
hostgroups switches
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
| define service{
use generic-service
host_name cisco3560
service_description GigabitEthernet0/24
check_command check-snmp-int!public!-n '^GigabitEthernet0/24$' -k -f -w 20000,50000 -c 100000,200000
}
define service{
use generic-service
host_name cisco3560
service_description Vlan100
check_command check-snmp-int!public!-n '^Vlan100$' -k -f -w 20000,50000 -c 100000,200000
}
|
注: 定义服务是: max_check_attempts 参数建议修改为6(默认为4),因为此插件至少要运行3到4次甚至以上才能正常,每次读取一次数据并记录在临时文件中,如果监控中的服务一直处于UNKNOWN状态下,可以考虑先删除服务和对应的临时文件,然后重新添加服务,临时文件如下:
检查并重新加载配置文件:
1
2
| service nagios checkconfig 或:/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios reload
|
检查演示:
check_snmp_int.rar
(9.32 KB, 下载次数: 13)
|
|