Service notification not going to inherited contact group

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Service notification not going to inherited contact group

Postby roddie » Thu Aug 15, 2019 4:17 am

I have a server running "App X" looked after by a team of four people who are defined in the contact group "appx", I have a particular service check "Service X" where I want an extra individual (Joe) to be notified of problems with.

The contact group is specified in a host template directive and the additional contact is defined in the service definition. But when there is a problem, only Joe receives a notification. Can someone please help me understand where I've gone wrong with the inheritance?

Code: Select all
# host templates
define host{
        name                            generic-host
        notifications_enabled           1
        event_handler_enabled           1
        flap_detection_enabled          1
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        notification_period             24x7
        register                        0
        }

define host{
        name                            linux-server
        use                             generic-host
        check_period                    24x7
        check_interval                  5
        retry_interval                  1
        max_check_attempts              10
        check_command                   check-host-alive
        notification_period             workhours
        notification_interval           120
        notification_options            d,u,r
        contacts                        +roddie
        register                        0
        }

define host{
    name            rhel-server
    use             linux-server
    hostgroups      +rhel-servers
    register        0
    }

define host{
    name            appx-server
    use             rhel-server
    action_url      https://$HOSTNAME$.domain.com:1234/
    hostgroups      +appx-version2-servers
    contact_groups  appx
    register        0
    }

define host{
    name            appx-db-server
    use             appx-server
    hostgroups      +db-servers
    register        0
    }

define host{
    name            appx-int-server
    use             appx-db-server
    notes           App X Version 2 $_HOSTENV$ Integration Server
    hostgroups      +int-servers
    register        0
    }

define host{
    name            appx-test-server
    hostgroups      +test-servers
    _env            Test
    register        0
    }

# host definition
define host{
    use             appx-int-server,appx-test-server
    host_name       appx2inttest2
    address         10.0.0.5
    }

# service template
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
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        check_interval                  10
        retry_interval                  2
        notification_options            w,u,c,r
        notification_interval           0
        notification_period             24x7
        register                        0
        }

# service definition
define service{
        service_description     Service X
        servicegroups           os-services,backup-services
        hostgroup_name          db-servers
        use                     generic-service
        check_command           check_nrpe!check_servicex
        contacts                +joe
        }

# contactgroup definition
define contactgroup{
        contactgroup_name       appx
        alias                   App X
        members                 roddie,tom,dick,harry
        }
User avatar
roddie
 
Posts: 9
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: Service notification not going to inherited contact grou

Postby scottwilkerson » Thu Aug 15, 2019 7:22 am

If you explicitly define a contact or contact_group on the service, it will no longer inherit the contact_group on the host, so in your case you would need to additionally define the contact group "appx" to the service as well.

See Implied Inheritance
The following table lists the object variables that will be implicitly inherited from related objects if you don't explicitly specify their value in your object definition or inherit them from a template.

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectinheritance.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Service notification not going to inherited contact grou

Postby roddie » Thu Aug 15, 2019 7:47 am

Hi, Scott, thanks for the reply - that's the page I had been referring to when designing this setup but it doesn't really say that an explicit contact will cancel an inherited contact group (and presumably vice versa), so maybe that could be made more clear?
User avatar
roddie
 
Posts: 9
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: Service notification not going to inherited contact grou

Postby scottwilkerson » Thu Aug 15, 2019 7:54 am

I agree it could be clearer, I am going to have the following added:

For example, if you add a contact to a service, it will no longer inherit contacts or contact_groups from the host.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Service notification not going to inherited contact grou

Postby roddie » Thu Aug 15, 2019 8:56 am

That's great. Just to confirm, I've added the contact group to the service definition and can see notifications going to everyone now.
User avatar
roddie
 
Posts: 9
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: Service notification not going to inherited contact grou

Postby scottwilkerson » Thu Aug 15, 2019 8:56 am

roddie wrote:That's great. Just to confirm, I've added the contact group to the service definition and can see notifications going to everyone now.

Great!

Locking thread
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 8 guests