usa of multiple templates in contact-definition

Morris, Patrick patrick.morris at hp.com
Mon Sep 22 16:19:53 CEST 2008


> two contact-templates are defined:
>
> -------------------------
> # <ContactTemplate>
> # Normal workhours, 8-17
> define contact{
>         name                            contact-at-workhours
>         use                             generic-contact
>         service_notification_commands   notify-service-by-email
>         host_notification_commands      notify-host-by-email
>         register                        0
>         }
>
> # and one hour before work and 3 hours after, 7-8 + 17-21
> define contact{
>         name                            contact-at-prepostworkhours
>         use                             generic-contact
>         service_notification_period     prepostworkhours
>         host_notification_period        prepostworkhours
>         service_notification_commands   notify-service-by-email,notify-
> service-by-sms
>         host_notification_commands      notify-host-by-email,notify-
> host-by-sms
>         register                        0
>         }
> # </ContactTemplate>
>
> # <TimeperiodTemplate>
> define timeperiod{
>         timeperiod_name workhours
>         alias           Normal Work Hours
>         monday          08:00-17:00
>         tuesday         08:00-17:00
>         wednesday       08:00-17:00
>         thursday        08:00-17:00
>         friday          08:00-17:00
>         }
>
> define timeperiod{
>         timeperiod_name prepostworkhours
>         alias           Eine Stunde VOR der Schicht und die Spätschicht
> inklusive
>         monday          07:00-8:00,17:00-21:00
>         tuesday         07:00-8:00,17:00-21:00
>         wednesday       07:00-8:00,17:00-21:00
>         thursday        07:00-8:00,17:00-21:00
>         friday          07:00-8:00,17:00-21:00
>         }
> # </TimeperiodTemplate>
> ---------------------
>
> Then a contact person is defined:
>
> -----------------
> define contact{
>         contact_name                    iruprecht
>         use                             contact-at-workhours,contact-
> at-prepostworkhours
>         alias                           Vladimirs Vecgailis
>         email                           ilya_ruprecht at gmx.de
>         pager                           0179123123123
>         }
> -----------------
>
> So far so good.
>
> The problem is - the contact "iruprecht" is getting notifications only
> in the "workhours".
>
> I also see in the "View config"-menu, that  "iruprecht" will get
> notified only in the "workhours".
>
> The thing is, as far as i know YOU CAN use multiple template-references
> in the contact-definition.
> (At least it was told so by the speaker in a
> presentation(http://www.linuxtag.org/2008/de/conf/events/vp-
> mittwoch/vortragsdetails.html?talkid=64) at the LinuxTag 2008.

While it's true Nagios 3 supports multiple inheritance, it doesn't combine the values from both templates; it will only use the value from the second if they do not exist in the first:

http://nagios.sourceforge.net/docs/3_0/objectinheritance.html#multiple_templates

You'll need to define a timeperiod that covers the entire range you want notifications to be sent out.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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