Page 1 of 1

alerts for multiple groups

Posted: Mon Mar 07, 2016 10:16 pm
by pleegor
Hi,

I am having time configuring alerts for multiple groups in Nagios. I configured new users in contacts.cfg and new groups including those users. I also added notifications groups to the template I use. However, alerts are going to nagios admins only. Any help is appreciated!

Re: alerts for multiple groups

Posted: Mon Mar 07, 2016 10:20 pm
by Box293
If you define the contacts or contact_groups at a template level, are you also defining additional contacts or contact_groups on the object as well?

Can you please provide:

The host definition, any templates it uses and and templates the templates use
The service definition, any templates it uses and and templates the templates use
The contact definition, any templates it uses and and templates the templates use
The contact group definition

Also, be very specific about who the alerts are working for and not working for and if this is at the host or service level.

Re: alerts for multiple groups

Posted: Mon Mar 07, 2016 10:43 pm
by pleegor
Thanks for jumping on this issues! These are my configs:

host

Code: Select all

define host{
        host_name                       test
        use                             linux-server
        hostgroups                      jenkins-masters-test
        alias                           test
        address                         10.17.3.169
        check_command                   check-host-alive
        check_interval                  10.17.3.169
        retry_interval                  2
        max_check_attempts              2
        check_period                    24x7
        process_perf_data               0
        retain_nonstatus_information    0
        notification_interval           0
        notification_period             24x7
        notification_options            d,u,r
        }
template object (I just found out that template specifies to contact sys-admins)

Code: Select all

define host{
        name                            linux-server    ; The name of this host template
        use                             generic-host    ; This template inherits other values from the generic-host template
        hostgroups                      critical-linux-servers
        check_period                    24x7            ; By default, Linux hosts are checked round the clock
        check_interval                  5               ; Actively check the host every 5 minutes
        retry_interval                  1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts              10              ; Check each Linux host 10 times (max)
        check_command                   check-host-alive,check_local_disk,check_local_load ; Default command to check Linux hosts
        notification_period             24x7            ; Linux admins hate to be woken up, so we only notify during the day
                                                        ; Note that the notification_period variable is being overridden from
                                                        ; the value that is inherited from the generic-host template!
        notification_interval           10              ; Resend notifications every 2 hours
        notification_options            d,u,r,f,s               ; Only send notifications for specific host states
        contact_groups                  sys-admins      ; Notifications get sent to the admins by default
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }
service definition hostname is

Code: Select all

define service{
        use             generic-service         ; Inherit default values from a template
        hostgroup_name          critical-linux,jenkins-masters-qe,build-masters,qe-linux-slaves,web-services,qe-xen-servers,perf-servers,qe-vm
        host_name               wiki,test
        service_description     SSH Check
        check_command   check_ssh
}

contact definition

Code: Select all


define contact{
        contact_name                    pl33g0r
        alias                           pl33g0r
        email                           [email protected]
        service_notification_period     24x7                    ; service notifications can be sent anytime
        host_notification_period        24x7                    ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register                        1                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        }

contact group

Code: Select all

define contactgroup{
        contactgroup_name it-test
        alias             IT test
        members           pl33g0r
        }

Re: alerts for multiple groups

Posted: Tue Mar 08, 2016 12:22 am
by Box293
The only place I am seeing contacts or contact groups being assigned is in the linux-server host template.

I don't see anywhere in your definitions the contact group it-test being used.

Re: alerts for multiple groups

Posted: Tue Mar 08, 2016 12:43 am
by pleegor
I guess in this case scenario, it would be better not use any inherited templates and create a completely new one that has nothing inherited. Does it make sense?

Re: alerts for multiple groups

Posted: Tue Mar 08, 2016 12:46 am
by Box293
Using multiple templates is OK, as each template setting can be defined to inherit or block the previous templates.

Have a look in this article where it talks about additive inheritance.

https://assets.nagios.com/downloads/nag ... tance.html