我想将Nagios配置为在HostA或HostA上的任何服务出现问题时向用户A发送警报。第一部分 - 当 HostA 出现问题时 - 很简单,但是当给定主机(或主机组)上的任何服务出现问题时,我看不到如何向给定用户发送警报。需要明确的是:
如果主机 A 上的任何服务出现问题,请通知用户 A
如果主机 B 上的任何服务出现问题,请通知用户 B
有什么指示或想法吗?
在服务定义中,需要设置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并创建新的联系人组。