我们有 3 个服务模板low-priority
,high-priorty
和medium-priorty
。低优先级服务附加到low
联系人组medium
,中优先级服务附加到联系人组和高优先级(好吧,你可能明白了)。
低优先级服务不通知,中优先级警报通过电子邮件通知,高优先级警报通过电子邮件和电话通知。除了他们没有(还)
我需要做的是指定high-priorty
服务生成的任何警报都应该运行通知命令notify-service-by-email
和notify-service-by-phone
. 通过阅读文档(以及我对 Nagios 的了解),我知道设置通知命令的唯一方法是service_notification_commands
联系人中的选项,但这意味着每个联系人都需要两个定义,一个用于电话,一个用于电子邮件。我将如何获得high-priority
调用notify-service-by-phone
命令的服务?
更多信息;
;High priority service (Alert by call, 1 min check period)
define service{
name high-priority-service
notifications_enabled 1
normal_check_interval 1
contact_groups high
use generic-service
register 0
}
;Med priority service (Alert by email, 5 min check period)
define service{
name med-priority-service
notifications_enabled 1
normal_check_interval 5
contact_groups medium
use generic-service
register 0
}
;Low priority service (No alert, 10 min check period)
define service{
name low-priority-service
normal_check_interval 10
use generic-service
register 0
}
Run Code Online (Sandbox Code Playgroud)
(generic-service
是 NAGIOS 配置的默认模板,经过一些调整)
define service{
use high-priority-service
hostgroup_name generic-server-nrpe
service_description SSH
check_command check_ssh
}
Run Code Online (Sandbox Code Playgroud)
define contactgroup{
contactgroup_name low
alias Low Priority Notifications
members sam,[...]
}
define contactgroup{
contactgroup_name medium
alias Medium Priority Notifications
members sam,[...]
}
define contactgroup{
contactgroup_name high
alias High Priority Notifications
members sam,[...]
}
Run Code Online (Sandbox Code Playgroud)
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}
define contact{
contact_name sam
use generic-contact
alias Sam
email sam[...]
address1 +44[...]
}
Run Code Online (Sandbox Code Playgroud)
看来您需要定义两次联系人。一种定义仅通过电子邮件通知,另一种定义通过电子邮件和电话通知。
define contact{
name generic-contact-high
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email,notify-service-by-phone
host_notification_commands notify-host-by-email
register 0
}
define contact{
name generic-contact-med
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}
Run Code Online (Sandbox Code Playgroud)
您的联系人应根据以下两种类型的联系人来定义:
define contact{
contact_name sam-high
use generic-contact-high
alias Sam
email sam[...]
address1 +44[...]
}
define contact{
contact_name sam-med
use generic-contact-med
alias Sam
email sam[...]
address1 +44[...]
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11133 次 |
最近记录: |