How to make services use host notification configuration

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ruivoml
Posts: 2
Joined: Fri Sep 30, 2016 1:06 pm

How to make services use host notification configuration

Post by ruivoml »

Hello everyone!

Currently i'm trying to find a way (and find out if it is even possible) to setup my services configuration file so that the services will obey the notification settings from the hosts instead. Otherwise, if i'm not mistaken, i'll have to include one line, per host, for each service to setup which notification setting it will follow.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How to make services use host notification configuration

Post by lmiltchev »

Can you show us a specific example of a host and a service configs? What notification settings are you talking about? Are you using any custom templates?

If you wanted to inherit contacts from the host, you could place contacts in contact groups, and assign contact groups to your host. The services that are attached to this host will inherit contact groups from the host via implied inheritance, provided you don't have any contacts/contact groups added explicitly to the services .

Read more on Implied Inheritance here:
https://assets.nagios.com/downloads/nag ... tance.html
Be sure to check out our Knowledgebase for helpful articles and solutions!
ruivoml
Posts: 2
Joined: Fri Sep 30, 2016 1:06 pm

Re: How to make services use host notification configuration

Post by ruivoml »

lmiltchev wrote:Can you show us a specific example of a host and a service configs? What notification settings are you talking about? Are you using any custom templates?

If you wanted to inherit contacts from the host, you could place contacts in contact groups, and assign contact groups to your host. The services that are attached to this host will inherit contact groups from the host via implied inheritance, provided you don't have any contacts/contact groups added explicitly to the services .

Read more on Implied Inheritance here:
https://assets.nagios.com/downloads/nag ... tance.html
First of all thank you for your reply!

We're actually more interested in the notification period configuration for services and hosts. I.E, we want our services to inherit notification period configuration from the hosts themselves, instead of defining one notification period per service (something that would have us adding hundreds extra lines).

The document you linked really helped shed some light on it. We commented the "notification_period", "notification_interval" and "check_period" on our services inside the templates.cfg file, to see if the services will inherit the variable from the hosts instead on that file. Currently we are monitoring everything to see if it worked as we wanted it to.

Below are examples for a host and a service inside the templates.cfg file, with the modifications i mentioned:


templates.cfg

HOST:

Code: Select all

}
define host{
        name                            SAPDEVPIERP
        notifications_enabled           1
        event_handler_enabled           1
        failure_prediction_enabled      1
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        notification_period             SAPDEVPIERP
        check_interval                  3
        retry_interval                  1
        max_check_attempts              2
        check_command                   check-host-alive
        notification_interval           2040
        notification_options            d,u,r,f,s
        contact_groups                  4srDEV
        register                        0
}
SERVICE:

Code: Select all

define service{
        name                            SAPDEVPIERP
        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
        # check_period                    SAPDEVPIERP
        max_check_attempts              2
        normal_check_interval           3
        retry_check_interval            2
        contact_groups                  4sr
        notification_options            w,u,c,r
        # notification_interval           2040
        # notification_period             SAPDEVPIERP
        register                        0
}
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to make services use host notification configuration

Post by tmcdonald »

ruivoml wrote:Currently we are monitoring everything to see if it worked as we wanted it to.
Keep us posted!
Former Nagios employee
Locked