ルーター(スイッチ)のnagios監視

ルータとスイッチの監視が基本
CentOS5でNagios3.04構築【監視対象設定編】 - ささきんぐのひとりごと・・・は具体例が載っているのでなかなか役に立った

基本的には /etc/nagios/objects/switch.cfg の内容をいじるだけでネットワーク機器(ルータ、スイッチ)の監視ができる

# Define the switch that we'll be monitoring

define host{
        use             generic-switch
        host_name       linksys-srw224p
        alias           Linksys SRW224P Switch
        address         192.168.170.151
        hostgroups      switches
        }

# Create a new hostgroup for switches

define hostgroup{
        hostgroup_name  switches                ; The name of the hostgroup
        alias           Network Switches        ; Long name of the group
        }

# Create a service to PING to switch

define service{
        use                     generic-service
#       host_name               linksys-srw224p
        hostgroup_name          switches
        service_description     PING
        check_command           check_ping!200.0,20%!600.0,60%
        normal_check_interval   5
        retry_check_interval    1
        }

とりあえず設定が終わったら以下のセットを実行

# /usr/bin/nagios -v /etc/nagios/nagios.cfg
# service nagios restart

ちなみに監視対象のルータ(RTX1200)はデフォルトでSNMP対応だったので、以下の設定で監視サーバからのアクセスを許可するだけでおk

snmp host 192.168.11.179

SNMPトラップの設定

snmp trap host 192.168.11.179
snmp trap enable snmp all