1.下载监控插件
wget http://nagios-snmp.cvs.sourceforge.net/nagios-snmp/plugins/check_snmp_int.pl
2. 首先查看交换机目前开启的所有端口
for i in `seq 1 48`;do /usr/local/nagios/libexec/check_snmp_int.pl -H 192.168.0.254 -C public -n "^GigabitEthernet1/0/$i$";done
3. 添加监控
------------------------------------------------------------------------------------------
vim hosts.cfg
define host {
use generic-switch
host_name 3750M-port
alias 3750M-port
address 192.168.0.254
}
define host {
use generic-switch
host_name 3750S-port
alias 3750S-port
address 192.168.0.253
}
define hostgroup {
hostgroup_name 3750-port
alias 3750 port
members 3750M-port,3750S-port
}
------------------------------------------------------------------------------------------
vim commands.cfg
define command{
command_name check_snmp_int
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$
}
------------------------------------------------------------------------------------------
vim switch.cfg
define service{
use generic-service
hostgroup_name 3750-port
service_description GigabitEthernet1/0/0
contact_groups admins
check_command check_snmp_int!public!‘^GigabitEthernet1/0/[12456789]$‘
}
参考文档:
http://nagios.proy.org/snmp_int.html