timeperiods / exclude daily timespan with "exception" / nagios 3.2.x ?
Jim Avery
jim at jimavery.me.uk
Thu Dec 23 14:08:47 CET 2010
On 22 December 2010 08:42, <uplink.team at gmail.com> wrote:
> Hi all,
> I am trying to figure out the most elegant/readable way to specify a
> timeperiod (for notifications), which exclude a small timespan each day.
> In the 3.2 docs [1] there is mention of the "exclude" directive (which does
> not reliably work yet, as stated in the releaselog for 3.2.0 [1]) and a -
> more intriguing - "[exception]" directive.
> If I understand the former correctly, it's supposed to work like this (for
> creating a "blind-spot" of 5 minutes daily):
> define timeperiod{
> timeperiod_name exceptions_for_specific_service
> alias Exception for specific service
> day 1 - -1 06:35-06:40 # 06:35 - 06:40 daily
> }
>
> define timeperiod{
> timeperiod_name 24x7_exceptions_for_nlc_epichannel
> alias 24/7, but excluding 06:35 - 06:40 daily
> use 24x7
> exclude exceptions_for_specific_service
> }
>
>
> However, I fail at using the other directive [exception]. How is this
> supposed to work? There seems to be no details or examples anywhere...
> Can any of you please share a working example? Or point to some
> documentation I missed?
> Thanks for any help!
> Gustav
>
> [1] http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#timeperiod
> [2] http://www.nagios.org/projects/nagioscore/history/core-3x "Known issue:
> Service checks that are defined with timeperiods that contain "exclude"
> directi ves are incorrectly re-scheduled. Don't use these for now - we'll
> get this fixed for 3.4"
If you are just using the timeperiod for notifications
(notification_period) and not for check scheduling (check_period),
then I would hope the exclude directive will work ok. I confess I
haven't tested it myself - I'm just going by what it says in your note
[2].
The simple case I have here where I want to alert on all workdays
between midnight and midnight, excluding weekends and bank holidays
looks like this:
# U.K. holidays (actually just England and Wales) taken from
# http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_073741
# Last updated 06/12/2010 by JRTA - will need updating again before
Christmas 2011
define timeperiod{
name uk-holidays
january 3 00:00-24:00 ; New Years Day
april 22 00:00-24:00 ; Good Friday
april 25 00:00-24:00 ; Easter Monday
april 29 00:00-24:00 ; Royal Wedding
may 2 00:00-24:00 ; Early May Bank Holiday
may 30 00:00-24:00 ; Spring Bank Holiday
august 29 00:00-24:00 ; Summer Bank Holiday
december 27 00:00-24:00 ; Christmas
december 28 00:00-24:00 ; Boxing Day
register 0 ; This is a template
}
# That was just a template. This is the actual timeperiod which we
will use in an exclude directive later.
define timeperiod{
timeperiod_name ukholidays
alias UK Holidays
use uk-holidays
}
# workdays - all days which are not weekend or bank holidays
# note this includes the whole day midnight-midnight not just working hours
define timeperiod{
timeperiod_name workdays
alias Workdays - whole days which are not bank hol or weekend
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
exclude ukholidays
}
And in the service definition:
notification_period workdays
I hope that helps.
Cheers,
Jim
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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