Nagios自訂警示時間

來源:互聯網
上載者:User

標籤:nagios   監控   

Nagios自訂警示時間

遇到需要自訂檢查和警示時間的,總結一下。大家集思廣益,不斷完善。

常調用的模板設定檔:


efine service{

      name                           generic-service         ; 定義一個服務名稱

      active_checks_enabled          1                       ; Activeservice checks are enabled

      passive_checks_enabled         1                       ; Passiveservice checks are enabled/accepted

      parallelize_check              1                       ; Activeservice checks should be parallelized;
                                                              ; (disabling this can lead to major performance problems)

      obsess_over_service            1                       ; Weshould obsess over this service (if necessary)

      check_freshness                0                       ; Defaultis to NOT check service ‘freshness‘

      notifications_enabled          1                       ; Servicenotifications are enabled

      event_handler_enabled          1                       ; Serviceevent handler is enabled

      flap_detection_enabled         1                       ; Flapdetection is enabled

      failure_prediction_enabled     1                       ; Failureprediction is enabled

      process_perf_data              1                       ; Processperformance data

      retain_status_information      1                       ; Retainstatus information across program restarts

      retain_nonstatus_information   1                       ; Retainnon-status information across program restarts

      is_volatile                    0                       ; Theservice is not volatile

check_period                    24x7             ; 這裡的check_period告訴nagios檢查服務的時間段。

      max_check_attempts             3                ; nagios對服務的最大檢查次數。

      normal_check_interval          5                ; 此選項是用來設定服務檢查時間間隔,也就是說,nagios這一次檢查和下一次檢查之間所隔的時間;
                                                       ; 這裡是5分鐘。

      retry_check_interval           2                ; 重試檢查時間間隔,單位是分鐘。

      contact_groups                  admin            ; 指定連絡人群組

      notification_options           w,u,c,r          ; 這個定義的是“通知可以被發出的情況”。w即warn,表示警告狀態;
                                                        ; u即unknown,表示不明狀態;
                                                       ; c即criticle,表示緊急狀態,r即recover,表示恢複狀態;
                                                       ; 也就是在服務出現警告狀態、未知狀態、緊急狀態和重新恢複後都發送通知給使用者。

      notification_interval          10               ; Re-notify aboutservice problems every hour

notification_period             24x7             ; 指定“發送通知”的時間段,也就是可以在什麼時候發送通知給使用者。

      register                       0                ; DONT REGISTERTHIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!

      }

define service{

      name                            local-service           ; The name of this service template

      use                            generic-service         ; Inherit default values from thegeneric-service definition

      max_check_attempts             4             ; Re-check theservice up to 4 times in order to determine its final (hard) state

      normal_check_interval          5             ; Check the service every 5 minutes undernormal conditions

      retry_check_interval           1             ; Re-check theservice every minute until a hard state can be determined

      register                       0             ; DONT REGISTER THISDEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!

      }


[[email protected] objects]# cattimeperiods.cfg

………………….

define timeperiod{

      timeperiod_name 24x7

      alias           24 Hours A Day, 7Days 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 timeperiod{

      timeperiod_name rd_bus_engine_time

      alias           rd_bus_engine_time

      monday          07:55-08:05

      tuesday          07:55-08:05

      wednesday       07:55-08:05

      thursday         07:55-08:05

      friday           07:55-08:05

       saturday        07:55-08:05

       sunday         07:55-08:05

      }


defineservice{

    use                            local-service

    host_name                     10.19.190.22_bus_engine

     service_description           compile_critical_log

    contact_groups             rd-bus-engine-group

check_period                 rd_bus_engine_time

notification_period            rd_bus_engine_time

    notification_options           w,u,c,r

    check_command             check_nrpe!check_log

}


檢查重啟。



本文出自 “love笨笨的部落格” 部落格,請務必保留此出處http://6622951.blog.51cto.com/6612951/1413510

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.