我的所有Linux主机的联系人是admins Nagios contact_group 。 但是对于这个Linux主机,我会喜欢那个名为sandradebug的contact_group也会收到通知。
问题是,当我添加contact_groups sandradebug它仍然只有admins得到的通知,而不是sandradebug 。
题
我怎么能包括这个主机的sandradebug ,所以通知也发送到那里?
主机模板
define host { name linux-host use generic-host check_command check-host-alive notification_interval 4320 notification_options d,u,r contact_groups admins register 0 }
主机定义
define host { use linux-host host_name example alias example address 10.10.10.10 hostgroups default-linux-services contact_groups sandradebug }
问题是,当我添加
contact_groups sandradebug它仍然只有admins得到的通知,而不是sandradebug。
你重新启动了Nagios吗? 您的上述configuration将覆盖模板值,只有sandradebug组会收到这些警报。
我怎么能包括这个主机的
sandradebug,所以通知也发送到那里?
对象inheritance是你在找什么:
define host { use linux-host host_name example alias example address 10.10.10.10 hostgroups default-linux-services contact_groups +sandradebug }
使用+符号,主机定义使用模板中的数据,并将sandradebug添加到警报。
为此,我只是将模板与定义结合起来,因为您只使用一次:
define host { use generic-host host_name example alias example address 10.10.10.10 hostgroups default-linux-services check_command check-host-alive notification_interval 4320 notification_options d,u,r contact_groups sandradebug,admins }
可能发生的情况是您的模板正在覆盖指定的联系人组。