sending alert to multiple 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
pleegor
Posts: 9
Joined: Fri Apr 17, 2015 6:00 pm

sending alert to multiple contact group

Post by pleegor »

Hi,

I am trying to make notifications to be sent to various contact groups. I need an alert from on specific server in one host groups to be sent to multiple contact groups. When, I add contact_groups with a group name in hosts.cfg file alert is being sent only to contact group specified in the template.cfg template.

What is correct procedure and the syntax for setting up things like those? I am sure I am not the only who is trying to have this setup.

Thanks in advance!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: sending alert to multiple contact group

Post by ssax »

Please post your relevant configurations for the host and template.

The definition is like so:

Code: Select all

contact_groups			admins,anothergroup
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: sending alert to multiple contact group

Post by jdalrymple »

Works as expected:

Code: Select all

define contactgroup {
       contactgroup_name                        contactgroup_a
       alias                                    A
       members                                  andy
}

define contactgroup {
       contactgroup_name                        contactgroup_b
       alias                                    B
       members                                  bill
}

define host {
       host_name                                host_a
       use                                      template_a
       address                                  192.168.145.1
       contact_groups                           contactgroup_a
}

define host {
       host_name                                host_b
       use                                      template_b
       address                                  192.168.145.1
       contact_groups                           contactgroup_b
}

define host {
       host_name                                host_c
       use                                      template_a
       address                                  192.168.145.1
       contact_groups                           contactgroup_a, contactgroup_b
}
Attachments
Clipboard01.jpg
pleegor
Posts: 9
Joined: Fri Apr 17, 2015 6:00 pm

Re: sending alert to multiple contact group

Post by pleegor »

In my case I have one contact group defined in the template
this is host definition

Code: Select all

define host{
        host_name                       mobile.demo
        use                             linux-server
        hostgroups                      demo
        alias                           mobile.demo
        address                         172.x.x.x
        check_command                   check-host-alive
        check_interval                  3
        retry_interval                  1
        max_check_attempts              2
        check_period                    24x7
        contact_groups                  mobile
        process_perf_data               0
        retain_nonstatus_information    0
        notification_interval           10
        notification_period             24x7
        notification_options            d,u,r
        }
host template definition

Code: Select all


define host{
        name                          mobile_demo
        use                             generic-host
        hostgroups
        check_period                    24x7
        check_interval                  5
        max_check_attempts              10
        check_command                   check-host-alive,
        notification_period             24x7
        notification_interval           10
        notification_options            d,u,r
        contact_groups                  sys-admins
        register                        0
        }
As you can see I want to add another contacts group for mobile.demo host and keep sys-admins in the host template
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: sending alert to multiple contact group

Post by Box293 »

In your host definition you want:

Code: Select all

contact_groups                  +mobile
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pleegor
Posts: 9
Joined: Fri Apr 17, 2015 6:00 pm

Re: sending alert to multiple contact group

Post by pleegor »

I made the change (both suggestions) and now I am not getting any alerts. Just changed URL within in command.cfg to trigger and nothing happened...

This is how everything looks like now:

Code: Select all

define host{
        host_name                       mobile.demo
        use                             linux-server
        hostgroups                      demo
        alias                           mobile.demo.couchbase.com
        address                         172.23.105.16
        check_command                   check-host-alive
        check_interval                  3
        retry_interval                  1
        max_check_attempts              2
        check_period                    24x7
        contact_groups                  +mobile
        process_perf_data               0
        retain_nonstatus_information    0
        notification_interval           10
        notification_period             24x7
        notification_options            d,u,r,f
        }
hosts template:

Code: Select all

define host{
        name                            mobile_demo
        use                             generic-host
        hostgroups
        check_period                    24x7
        check_interval                  5
        max_check_attempts              10
        check_command                   check-host-alive,
        notification_period             24x7
        notification_interval           10
        notification_options            d,u,r,f,s
        contact_groups                  sys-admins
        register                        0
        }

contact template:

Code: Select all


define contact{
        contact_name                   pl33g0r
        use                             generic-contact
        alias                           pl33g0r
        email                           pl33g0r@gmail.com
        }

define contactgroup{
        contactgroup_name mobile
        alias             mobile-devs
        members           pl33g0r
        }

Thanks for help again!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: sending alert to multiple contact group

Post by Box293 »

A great way to test if a notification will work is to go to the object itself in the GUI and under Host Commands click "Send custom host notification".

Also, have a look in /usr/local/nagios/var/objects.cache and find the definition for the host mobile.demo, post it here.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
pleegor
Posts: 9
Joined: Fri Apr 17, 2015 6:00 pm

Re: sending alert to multiple contact group

Post by pleegor »

Sorry for such a late reply on this issue:

Code: Select all

define host {
        host_name       mobile.demo
        alias   mobile.demo.couchbase.com
        address 172.23.105.16
        check_period    24x7
        check_command   check-host-alive
        contact_groups  mobile-devs,sys-admins
        notification_period     24x7
        initial_state   o
        importance      0
        check_interval  3.000000
        retry_interval  1.000000
        max_check_attempts      2
        active_checks_enabled   1
        passive_checks_enabled  1
        obsess  1
        event_handler_enabled   1
        low_flap_threshold      0.000000
        high_flap_threshold     0.000000
        flap_detection_enabled  1
        flap_detection_options  a
        freshness_threshold     0
        check_freshness 0
        notification_options    r,d,u,f
        notifications_enabled   1
        notification_interval   10.000000
        first_notification_delay        0.000000
        stalking_options        n
        process_perf_data       0
        retain_status_information       1
        retain_nonstatus_information    0
        }
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: sending alert to multiple contact group

Post by Box293 »

Did this work?
Box293 wrote:A great way to test if a notification will work is to go to the object itself in the GUI and under Host Commands click "Send custom host notification".
The host object looks good, we can see it is correctly getting both groups: "mobile-devs,sys-admins".

It might be easier if you could PM me a copy of /usr/local/nagios/var/objects.cache and I'll go over everthing to make sure it is OK.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked