是否可以仅覆盖一个 Nagios 主机组的联系人?

San*_*dra 4 linux ubuntu centos nagios

我所有 linux 主机的联系人是adminsNagios contact_group。但是对于这个 Linux 主机,我希望被contact_group调用者sandradebug也得到通知。

问题是,当我添加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
}
Run Code Online (Sandbox Code Playgroud)

主机定义

define host {
  use                     linux-host
  host_name               example
  alias                   example
  address                 10.10.10.10
  hostgroups              default-linux-services
  contact_groups          sandradebug
}
Run Code Online (Sandbox Code Playgroud)

qua*_*nta 6

问题是,当我添加contact_groups sandradebug它时,它仍然只是admins收到通知,而不是 sandradebug.

您是否重新启动了 Nagios?您的上述配置将覆盖模板值,并且只有sandradebug组会收到这些警报。

我怎样才能包括sandradebug这个主机,以便通知也会发送到那里?

对象继承是您正在寻找的:

define host {
    use                     linux-host
    host_name               example
    alias                   example
    address                 10.10.10.10
    hostgroups              default-linux-services
    contact_groups          +sandradebug
}
Run Code Online (Sandbox Code Playgroud)

使用+标志,主机定义使用模板中的数据并将其添加sandradebug到警报中。