Host-based notifications vs- service-based notifications


#1

Hello everyone,

there is a specific part of nagios-tweaking I’d like to achieve but can’t manage to do correctly, nor did I find a solution on this forum (so far :frowning: ).

each of the hosts I am monitoring in my nagios config belong to some department responsible for them.
therefore, i defined contact_groups and hosts templates that leverage the required typing to define who should receive notifications for what.
It works fine so far, and each department receive notifications for its beloved hosts, except that those notifications only monitor the hosts status and not the services attached to those hosts.

So, the “normal” way would be to define contact_groups instances in each service. But I would like, again, that each department only receives notifications for the services applied on its hosts. which means defining for each service again the appropriate contact_group.

That could be done by using templates and use inheritance, but I have already lots of templates and if it requires writing as many templates than I require to add the contact_groups node (which i defaulted to none in my root template) for the services, it’s not really worth the hassle.
Multiple inheritance could make it already a little bit easier, but I have only nagios 2.9 and 1.2 on the monitoring systems and there is no chance they’re going to be upgraded in a near future.

So, is there anyway I could my services sent notifications only to the contact_groups defined for the hosts they apply on without having to define the contact_groups for the services themselves ?
is there an option that I miss that allows to do that, something like a transient configuration ?
or something simpler I might have overlooked ?

Thanks in advance for your help.

And I know this may sound lazy and far-fetched to try to reduce the amount of definitions and configurations lines, but we actually have a huge amount of stuffs to monitor, and I tried to use such “automated” behaviors as much as possible so that my followers/successors may not die in horrible pain by trying to dig their way through the config if they want to edit them (and a LOT of people OFTEN want to edit them. that was just a mess when I came, and I’d be happy if it could,at least for a while, stay as sane and simple as I reconfigured it).

those are some of my host-templates

define host {
  name                          generic-host
  notifications_enabled         1
  event_handler_enabled         1
  flap_detection_enabled        1
  failure_prediction_enabled    1
  process_perf_data             1
  retain_status_information     1
  retain_nonstatus_information  1
  notification_period           24x7
  register                      0
}

define host {
  use                           generic-host
  name                          std-host
  check_command                 check-host-alive
  max_check_attempts            10
  notification_interval         0
  notification_period           24x7
  notification_options          d,u,r
  contact_groups                contact-group-none
  hostgroups                    host-group-all
  register                      0
}

those are some of my service-templates

define service{
  name                            generic-service
  active_checks_enabled           1
  passive_checks_enabled          1
  parallelize_check               1
  obsess_over_service             1
  check_freshness                 0
  notifications_enabled           1
  event_handler_enabled           1
  flap_detection_enabled          1
  failure_prediction_enabled      1
  process_perf_data               1
  retain_status_information       1
  retain_nonstatus_information    1
  is_volatile                     0
  register                        0
  contact_groups                  contact-group-none
}

define service{
  use                             generic-service
  name                            std-service
  check_period                    24x7
  notification_interval           0
  notification_period             24x7
  notification_options            w,u,c,r
  register                        0
}

of course, all contacts I use have the following:

  service_notification_commands   notify-by-email
  host_notification_commands      host-notify-by-email