怎么设置nagios 监控交换机的端口
1.cd /usr/local/nagios/etc/objects
,增加需要的交换机,示例配置
SW.cfg:
define host{
use
generic-switch
host_name
xxx
alias
xxxx
address
192.168.x.x
check_command
check-host-alive
initial_state
o
max_check_attempts
2
check_interval
1
retry_interval
check_period
24x7
freshness_threshold
event_handler
notify-host-by-email
flap_detection_options
o,d,u
contacts
notification_interval
notification_period
first_notification_delay
notification_options
d,u,r,f,s
notifications_enabled
stalking_options
register
}
define service{
generic-service
service_description
xxxxx
check_snmp_interface!public!ifOperStatus.10113
normal_check_interval
retry_check_interval
2.配置完上面的后,在 /usr/local/nagios/etc
下编辑 nagios.cfg 文件,相应的位置增加上面的
配置:
cfg_file=/usr/local/nagios/etc/objects/SW.cfg
3.如果在 /usr/local/nagios/etc/objects/commands.cfg里面没有 check_snmp_interface 这个命令,
可以编辑该文件,增加:
vi commands.cfg
define command {
command_namecheck_snmp_interface
command_line$USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -c
register1
4.查看 ifOperStatus 的命令
snmpwalk-v2c-cpublic 192.168.x.xifOperStatus
-v snmp 的版本, 2c 是 v2 版本,不加密的。
-c 是跟团体名,默认是public ,如有自己改动,则自行修改。