Using two or more host templates to aggregate contacts

Guy Waugh guidosh at gmail.com
Tue Jul 7 17:36:37 CEST 2009


Hi all,

I'm trying to configure nagios 3.0.6 so that I can add contact groups to a
host by adding a host template to the host definition.

I have one host template called 'unix-host' that I'm using to aggregate the
Unix Team contacts into a template. I have another host template called
'oncall-host' that I'm using to represent people on call 24x7. If a host is
critical enough that the on-call people should be alerted if it goes down, I
want to be able to add the 'oncall-host' host template as a template for the
critical host, have the 'unix-host' host template as another template for
the host, and have nagios alert both the people on call and the Unix Team
admins if the host goes down. The on-call people should be alerted by SMS
and email every 5 minutes, but the Unix Team admins are should only be
alerted by email every 10 minutes.

I have an email server called 'doris' that is currently down, and is
configured as specified below. What's happening is that the on-call people
are being alerted by SMS and email every 10 minutes (which is as it should
be), but the Unix Team admins aren't being alerted at all. If I remove the
'oncall-host' template from the host definition, the Unix Team admins are
alerted by email as they should be.

Can anyone suggest how I might get the alerting working, and still be able
to just add the 'oncall-host' template as a template for a critical host?
Perhaps it would be better to do this with hostgroups?

Here are all my definitions... sorry if it's a bit convoluted:

Here's the host definition for the host in question:
define host {
        host_name                       doris
        alias                           doris email server
        address                         192.168.2.25
        parents                         sw-l3-mail
        use                             oncall-host,unix-host
        register                        1
}

'unix-host' host template:
define host {
       name                                   unix-host
       alias                                    Unix Team host template
       use                                      generic-host
       contact_groups                 +unix-admin
       register                               0
}

'oncall-host' host template:
define host {
       name                                     oncall-host
       alias                                    Host template for critical
hosts
       use                                      generic-host
       contact_groups                           oncall-primary
       notification_interval                    5
       register                                 0
}

'generic-host' host template:
define host {
       name                                     generic-host
       alias                                    Top-level host template
       check_command                            check-host-alive
       max_check_attempts                       10
       check_interval                           5
       retry_interval                           1
       active_checks_enabled                    1
       check_period                             24x7
       obsess_over_host                         1
       check_freshness                          1
       event_handler                            notify-host-by-email
       event_handler_enabled                    1
       flap_detection_enabled                   1
       process_perf_data                        1
       retain_status_information                1
       retain_nonstatus_information             1
       notification_interval                    10
       notification_period                      24x7
       notification_options                     d,u,r
       notifications_enabled                    1
       failure_prediction_enabled               1
       register                                 0
}

'unix-admin' contact group:
define contactgroup {
        contactgroup_name                       unix-admin
        alias                                   Unix Team Admins
        members                                 nagiosadmin
}

'oncall-primary' contact group:
define contactgroup {
        contactgroup_name                       oncall-primary
        alias                                   On-call Primary
        members                                 oncall_phone1
}

'nagiosadmin' contact:
define contact {
        contact_name                            nagiosadmin
        alias                                   Nagios Admin
        contactgroups                           unix-admin
       email                                   nagiosadmin at mydomain.co.uk
        use                                     human-contact
}

'oncall-phone1' contact:
define contact {
        contact_name                            oncall_phone1
        alias                                   On-call Phone #1
        contactgroups                           oncall-primary
        email                                   phone1 at mydomain.co.uk
        pager                                   07555555555
        use                                     oncall-contact
}

'human-contact' contact template:
define contact {
        name                                    human-contact
        alias                                   Human contact template
        contactgroups                           unix-admin
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,u,r
        service_notification_options            w,u,c,r
        host_notification_commands              notify-host-by-email
        service_notification_commands           notify-service-by-email
        use                                     generic-contact
        register                                0
}

'oncall-contact' contact template:
define contact {
        name                                    oncall-contact
        alias                                   On-call contact template
        contactgroups                           oncall-primary
        host_notification_period                24x7
        service_notification_period             24x7
        host_notification_options               d,r
        service_notification_options            u,c,r
        host_notification_commands
notify-host-by-email,notify-host-by-sms
        service_notification_commands
notify-service-by-email,notify-service-by-sms
        use                                     generic-contact
        register                                0
}

'generic-contact' contact template:
define contact {
        name                                    generic-contact
        alias                                   Highest-level contact
template
        host_notifications_enabled              1
        service_notifications_enabled           1
        host_notification_period                24x7
        service_notification_period             24x7
        register                                0
}

Regards,
Guy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090707/d37d8f83/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list