Service notification not going to inherited contact group

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
User avatar
roddie
Posts: 10
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Service notification not going to inherited contact group

Post by roddie »

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
        }
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service notification not going to inherited contact grou

Post by scottwilkerson »

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/nag ... tance.html
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
roddie
Posts: 10
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: Service notification not going to inherited contact grou

Post by roddie »

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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service notification not going to inherited contact grou

Post by scottwilkerson »

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.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
User avatar
roddie
Posts: 10
Joined: Tue Apr 24, 2018 3:23 pm
Location: Services (Unhandled)

Re: Service notification not going to inherited contact grou

Post by roddie »

That's great. Just to confirm, I've added the contact group to the service definition and can see notifications going to everyone now.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Service notification not going to inherited contact grou

Post by scottwilkerson »

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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked