您好,登錄后才能下訂單哦!
遇到需要自定義檢查和報警時間的,總結一下。大家集思廣益,不斷完善。
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!
}
[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
}
檢查重啟。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。