溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Nagios自定義報警時間

發(fā)布時間:2020-06-15 16:51:57 來源:網(wǎng)絡(luò) 閱讀:1348 作者:yueyuanyiluo 欄目:移動開發(fā)

Nagios自定義報警時間

遇到需要自定義檢查和報警時間的,總結(jié)一下。大家集思廣益,不斷完善。

常調(diào)用的模板配置文件:


efine service{

      name                           generic-service         ; 定義一個服務(wù)名稱

      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檢查服務(wù)的時間段。

      max_check_attempts             3                ; nagios對服務(wù)的最大檢查次數(shù)。

      normal_check_interval          5                ; 此選項是用來設(shè)置服務(wù)檢查時間間隔,也就是說,nagios這一次檢查和下一次檢查之間所隔的時間;
                                                       ; 這里是5分鐘。

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

      contact_groups                  admin            ; 指定聯(lián)系人組

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

      notification_interval          10               ; Re-notify aboutservice problems every hour

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

      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!

      }


[root@SHUBEI-34-223 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

}


檢查重啟。



向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI