我想将 Nagios 设置为通过电子邮件发出警告(例如,负载或磁盘使用量略高),但对于关键项目,要通过寻呼机发出警报。
现在,我们同时通过电子邮件和寻呼机通知所有警告。我的通用接触定义如下:
define contact{
name generic-contact
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-pager
host_notification_commands notify-host-by-email,notify-host-by-pager
register 0
service_notification_period 24x7
host_notification_period 24x7
}
Run Code Online (Sandbox Code Playgroud)
我如何才能使警告和严重的电子邮件通知都发生,但仅对严重的进行分页?
the*_*bit 11
您应该能够通过定义不同的联系人来实现这一点 - 一个仅用于寻呼机通知,一个仅用于电子邮件通知 - 并分配不同的值host/service_notification_options
:
define contact{
name email-contact
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
service_notification_period 24x7
host_notification_period 24x7
}
define contact{
name pager-contact
service_notification_options c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-pager
host_notification_commands notify-host-by-pager
register 0
service_notification_period 24x7
host_notification_period 24x7
}
Run Code Online (Sandbox Code Playgroud)
如果您想保持主机/服务定义的开销较低,您应该将它们聚合在一个联系人组中,如下所示:
define contactgroup{
contactgroup_name pager-email
members pager-contact,email-contact
}
Run Code Online (Sandbox Code Playgroud)
并使用联系人组而不是个人联系人。