天天看點

用nagios監控交換機的端口

怎麼設定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 ,如有自己改動,則自行修改。

繼續閱讀