usa of multiple templates in contact-definition

Andreas Ericsson ae at op5.se
Tue Sep 23 09:05:45 CEST 2008


Ilya Ruprecht wrote:
> Dear list,
> 
> following situation:
> 
> 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.
> 
> But somehow it seems not to work..
> 
> 
> The Nagios-version used is 3.0.3.
> 

You've specified your templates in the wrong order. Switch the ordering
in the contact object's "use" statement and the timeperiods will start
working.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
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