我想配置Nagios,以便在HostA或HostA上的任何服务出现问题时向UserA发送警报。第一部分 - 当HostA出现问题时 - 很简单,但是当给定主机(或主机组)上的任何服务出现问题时,我无法看到如何向给定用户发送警报。要明确:
如果HostA上的任何服务出现问题,请通知用户A 如果HostB上的任何服务出现问题,请通知UserB
任何指针或想法?
答案 0 :(得分:0)
在服务定义中,您需要设置contact_groups(并在其他地方定义组)。这是一个例子:
define service{
name A-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
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
notification_interval 0 ; Only send notifications on status$
is_volatile 0
check_period 24x7
normal_check_interval 5
retry_check_interval 1
max_check_attempts 4
notification_period 24x7
notification_options w,u,c,r
contact_groups A_only ; >>>Here's the magic you need<<<
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SE$
}
# for contact config file
define contactgroup{
contactgroup_name A_only
alias APeople
members APerson1, APerson2
}
对于B组,将A_only更改为B_only并创建一个新的联系人组。