Page 1 of 1
Problem excluding time periods for services
Posted: Wed Aug 14, 2013 7:07 am
by DennisPR
I've got a problem with an exclusion of a time period for a certain service.
I've created the following time periods
Code: Select all
define timeperiod {
timeperiod_name exclusion
alias exclusion
wednesday 14:00-14:10
}
define timeperiod {
timeperiod_name test-exclude
alias test-exclude
exclude exclusion
friday 00:00-24:00
saturday 00:00-24:00
thursday 00:00-24:00
monday 00:00-24:00
sunday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
}
If I run the test before 14:00 the next check time jumps to 00:00:00 (the next day) in stead of 14:10 today
Service State: Ok
Duration: 3m 1s
Service Stability: Unchanging (stable)
Last Check: 2013-08-14 13:58:11
Next Check:
2013-08-15 00:00:00
Is this a bug or am I doing something wrong ?
Re: Problem excluding time periods for services
Posted: Wed Aug 14, 2013 10:18 am
by abrist
What version of XI are you running? Is you server's time/date/timezone correct?
Re: Problem excluding time periods for services
Posted: Mon Aug 19, 2013 10:11 am
by DennisPR
I'm using Nagios XI 2012R2.2
Time zone is set to "Europe/Brussels" in /etc/sysconfig/clock so that seems OK
Re: Problem excluding time periods for services
Posted: Mon Aug 19, 2013 10:14 am
by slansing
What is your PHP time set to?
Re: Problem excluding time periods for services
Posted: Tue Aug 20, 2013 2:59 am
by DennisPR
cat /etc/php.ini | grep timezone
Code: Select all
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Europe/Brussels
Re: Problem excluding time periods for services
Posted: Tue Aug 20, 2013 9:14 am
by slansing
Is that the correct timezone for the Nagios XI server? Also, have you tried adding definitions in your timeperiod for every day of the week, then saving and applying configuration. Now check to see what happens at 14:00-:14:10. "This will require you to move that exclusion to today to validly test this. You could even pick a closer time period such as 10:00-10:10, etc. Let us know what happens once you add 00:00-24:00 to each of your days. like the test-exclude timeperiod as this may be causing the problem, you are probably going to need to add a longer timeperiod on Wednesday if you want checks to be done then.
Re: Problem excluding time periods for services
Posted: Mon Sep 09, 2013 4:21 am
by DennisPR
Europe/Brussels is the time zone I am in so that is correct.
I've changed the time periods on monday at 11:10 as followed :
Code: Select all
define timeperiod {
timeperiod_name exclusion
alias exclusion
saturday 11:20-11:30
friday 11:20-11:30
thursday 11:20-11:30
wednesday 11:20-11:30
tuesday 11:20-11:30
monday 11:20-11:30
sunday 11:20-11:30
}
define timeperiod {
timeperiod_name test-exclude
alias test-exclude
friday 00:00-24:00
saturday 00:00-24:00
thursday 00:00-24:00
monday 00:00-24:00
sunday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
}
I'm using the following test :
Code: Select all
define service {
host_name SRV9998A
service_description Test spooler
use dpr-2min-service
check_command check_xi_service_nsclient!N4gi0s!SERVICESTATE!-l spooler -d SHOWFAIL!!!!!
check_period test-exclude
register 1
}
This is the dpr-2min-service template :
Code: Select all
define service {
name dpr-2min-service
max_check_attempts 3
check_interval 2
retry_interval 1
check_period test-exclude
notification_interval 1440
notification_period 24x7
notification_options w,c,r,
notifications_enabled 1
register 0
}
The service was executed at 11:18:01 and set to be exucted again at 11:20:01.
At 11:20:01 it was to be excuted again at 11:22:01 ??
Re: Problem excluding time periods for services
Posted: Mon Sep 09, 2013 10:07 am
by lmiltchev
Timeperiod exclusions don't work as they are supposed to when they have the same precedence. You can use exclusions if you are using "specific" periods (not in the "monday 00:00-02:00" format). You would suggest not using exclusions at all - you can use the following timeperiod definition as a workaround:
Code: Select all
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-14:00,14:10-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
sunday 00:00-24:00
Re: Problem excluding time periods for services
Posted: Wed Sep 11, 2013 3:35 am
by DennisPR
You are right lmiltchev that is exactly the workaround I have used.
But I would still like to figure out how the time period exclusion works
Can anyone give an example config of a working time period exclusion ?
Re: Problem excluding time periods for services
Posted: Wed Sep 11, 2013 10:51 am
by lmiltchev
Code: Select all
define timeperiod {
timeperiod_name test1_notification_times
alias Notification Times for test1
exclude us-holidays
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
monday 00:00-24:00
sunday 00:00-24:00
}
define timeperiod {
timeperiod_name us-holidays
alias U.S. Holidays
name us-holidays
thursday -1 november 00:00-00:00
july 4 00:00-00:00
monday 1 september 00:00-00:00
january 1 00:00-00:00
december 25 00:00-00:00
}
define timeperiod {
timeperiod_name test2_notification_times
alias Notification Times for test2
exclude dec25
saturday 00:00-24:00
friday 00:00-24:00
thursday 00:00-24:00
wednesday 00:00-24:00
tuesday 00:00-24:00
monday 00:00-24:00
sunday 00:00-24:00
}
define timeperiod {
timeperiod_name dec25
alias Excluding Dec 25
name dec25
december 25 00:00-00:00
}