% vi localhost.cfg
# 監視時間の定義、定義した設定を 24x7 と名付ける
define timeperiod{
       timeperiod_name 24x7
       alias           24 Hours A Day, 7 Days A Week
       sunday          00:00-24:00
       monday          00:00-24:00
       tuesday         00:00-24:00
       wednesday       00:00-24:00
       thursday        00:00-24:00
       friday          00:00-24:00
       saturday        00:00-24:00
       }
# コンタクト(連絡手段)の設定
define contact{
       contact_name                    nagios-admin
       alias                           Nagios Admin
       service_notification_period     24x7
       host_notification_period        24x7
       service_notification_options    w,u,c,r
       host_notification_options       d,r
       service_notification_commands   notify-by-email
       host_notification_commands      host-notify-by-email
       email                           alert@example.com
       }
define contactgroup{
       contactgroup_name       admins
       alias                   Nagios Administrators
       members                 nagios-admin
       }
# ホスト種類の設定
define host{
       name                            linux-server    ; The name of this host template
       use                             generic-host    ; This template inherits other values from the generic-host template
       check_period                    24x7            ; By default, Linux hosts are checked round the clock
       max_check_attempts              10              ; Check each Linux host 10 times (max)
       check_command                   check-host-alive ; Default command to check Linux hosts
       notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day
                                                       ; Note that the notification_period variable is being overridden from
                                                       ; the value that is inherited from the generic-host template!
       notification_interval           120             ; Resend notification every 2 hours
       notification_options            d,u,r           ; Only send notifications for specific host states
       contact_groups                  admins          ; Notifications get sent to the admins by default
       register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
       }
define host{
       use                     linux-server            ; Name of host template to use
                                                       ; This host definition will inherit all variables that are defined
                                                       ; in (or inherited by) the linux-server host template definition.
       host_name               localhost
       alias                   localhost
       address                 127.0.0.1
       }
# サービス(実際の監視対象とコマンドの関連付け)の設定
define service{
       name                            generic-service         ; The 'name' of this service template
       active_checks_enabled           1                       ; Active service checks are enabled
       passive_checks_enabled          1                       ; Passive service checks are enabled/accepted
       parallelize_check               1                       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
       obsess_over_service             1                       ; We should obsess over this service (if necessary)
       check_freshness                 0                       ; Default is to NOT check service 'freshness'
       notifications_enabled           1                       ; Service notifications are enabled
       event_handler_enabled           1                       ; Service event handler is enabled
       flap_detection_enabled          1                       ; Flap detection is enabled
       failure_prediction_enabled      1                       ; Failure prediction is enabled
       process_perf_data               1                       ; Process performance data
       retain_status_information       1                       ; Retain status information across program restarts
       retain_nonstatus_information    1                       ; Retain non-status information across program restarts
       is_volatile                     0                       ; The service is not volatile
       register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
       } 
define service{
       use                             local-service         ; Name of service template to use
       host_name                       localhost
       service_description             HTTP
       check_command                   check_http
       }