Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

The contact for all my linux hosts is the admins Nagios contact_group. But for this one Linux host would I like that the contact_group called sandradebug also gets notified.

The problem is, that when I add contact_groups sandradebug it is still only admins that gets the notification and not also sandradebug.

Question

How can I include sandradebug for this one host, so notifications are also sent there?

Host template

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
}

Host definition

define host {
  use                     linux-host
  host_name               example
  alias                   example
  address                 10.10.10.10
  hostgroups              default-linux-services
  contact_groups          sandradebug
}
share|improve this question
1  
Just to be clear, we are talking about notifications for the host example, aren't we? Not notifications for the services on host example (which will be getting data from a completely different template, very likely)? –  MadHatter Jul 4 '13 at 16:21

2 Answers 2

up vote 4 down vote accepted

The problem is, that when I add contact_groups sandradebug it is still only admins that gets the notification and not also sandradebug.

Have you restarted the Nagios? Your above configuration will override the template values and only sandradebug group will receive these alerts.

How can I include sandradebug for this one host, so notifications are also sent there?

Object Inheritance is what you are looking for:

define host {
    use                     linux-host
    host_name               example
    alias                   example
    address                 10.10.10.10
    hostgroups              default-linux-services
    contact_groups          +sandradebug
}

Using the + sign, the host definition uses the data in the template and adds the sandradebug to the alerts.

share|improve this answer

For this, I would just combine the template with the definition since you're only using it once:

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
}

What's likely happening is that your template is overriding the contact group specified.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.