Using time periods with services checks
-
Frédéric GRANAT
- Posts: 445
- Joined: Mon Nov 19, 2012 11:36 am
Using time periods with services checks
Hi,
Here are the characteristics of my nagiosxio environement :
Linux version 2.6.18-308.13.1.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52))
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386
Manual install of NagiosXI
I want to check backupexec jobs and I use check_be.exe (for further informations see http://exchange.nagios.org/directory/Pl ... ck/details)
for example, my job is planned each first monday of the month, so I want to check it each tuesday following that day.
I created a Time Period having these characteristics
define timeperiod {
timeperiod_name mercredi_suivant_premier_mardi
alias Mercredi suivant le premier Mardi du mois
wednesday 00:00-24:00
use periode_mardi1_mardi2
}
define timeperiod {
timeperiod_name periode_mardi1_mardi2
alias jour compris entre le 1er Mardi du mois et le second
name periode_mardi1_mardi2
tuesday 1 - tuesday 2 00:00-24:00
}
I created a service template :
define service {
name sauvegardes_premier_mardi
service_description Supervise les sauvegardes du premier Mardi du mois
display_name sauvegardes_premier_mardi
servicegroups Sauvegardes
use generic_sauvegardes
check_period mercredi_suivant_premier_mardi
notifications_enabled 0
register 0
}
define service {
name generic_sauvegardes
is_volatile 0
max_check_attempts 3
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
obsess_over_service 1
check_freshness 0
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period 24x7
notifications_enabled 1
contact_groups all
failure_prediction_enabled 1
register 0
}
At the end I created a service using the template sauvegardes_premier_lundi
define service {
host_name W2K8-SRVBACKUP.cg.ahp
service_description BackupExec [EXPORT]-System State Check
use sauvegardes_premier_mardi
check_command check_nrpe!check_export_system_state
register 1
}
I apply that service on nagiosxi, the check appears but it says that "Service check is pending... Check is scheduled for 2012-12-04 00:00:00"
Whereas it shoud be planned on 2012-12-05 (the wednesday following the first tuesday).
Do you have any explanation ?
Regards,
Frederic
Here are the characteristics of my nagiosxio environement :
Linux version 2.6.18-308.13.1.el5 ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52))
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386
Manual install of NagiosXI
I want to check backupexec jobs and I use check_be.exe (for further informations see http://exchange.nagios.org/directory/Pl ... ck/details)
for example, my job is planned each first monday of the month, so I want to check it each tuesday following that day.
I created a Time Period having these characteristics
define timeperiod {
timeperiod_name mercredi_suivant_premier_mardi
alias Mercredi suivant le premier Mardi du mois
wednesday 00:00-24:00
use periode_mardi1_mardi2
}
define timeperiod {
timeperiod_name periode_mardi1_mardi2
alias jour compris entre le 1er Mardi du mois et le second
name periode_mardi1_mardi2
tuesday 1 - tuesday 2 00:00-24:00
}
I created a service template :
define service {
name sauvegardes_premier_mardi
service_description Supervise les sauvegardes du premier Mardi du mois
display_name sauvegardes_premier_mardi
servicegroups Sauvegardes
use generic_sauvegardes
check_period mercredi_suivant_premier_mardi
notifications_enabled 0
register 0
}
define service {
name generic_sauvegardes
is_volatile 0
max_check_attempts 3
check_interval 5
retry_interval 1
active_checks_enabled 1
passive_checks_enabled 1
obsess_over_service 1
check_freshness 0
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
notification_period 24x7
notifications_enabled 1
contact_groups all
failure_prediction_enabled 1
register 0
}
At the end I created a service using the template sauvegardes_premier_lundi
define service {
host_name W2K8-SRVBACKUP.cg.ahp
service_description BackupExec [EXPORT]-System State Check
use sauvegardes_premier_mardi
check_command check_nrpe!check_export_system_state
register 1
}
I apply that service on nagiosxi, the check appears but it says that "Service check is pending... Check is scheduled for 2012-12-04 00:00:00"
Whereas it shoud be planned on 2012-12-05 (the wednesday following the first tuesday).
Do you have any explanation ?
Regards,
Frederic
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using time periods with services checks
In the timeperiod mercredi_suivant_premier_mardi you have a line
This is going to include the times in periode_mardi1_mardi2 which is tuesday
Code: Select all
use periode_mardi1_mardi2-
Frédéric GRANAT
- Posts: 445
- Joined: Mon Nov 19, 2012 11:36 am
Re: Using time periods with services checks
Hi,
But I also precised in my Time period definition :
wednesday 00:00-24:00
So that should be on wednesday and between tuesday 1 and tuesday 2, isn't it ?
Rgds,
Frederic
But I also precised in my Time period definition :
wednesday 00:00-24:00
So that should be on wednesday and between tuesday 1 and tuesday 2, isn't it ?
Rgds,
Frederic
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using time periods with services checks
no, it would add both of them (even though they overlap)
-
Frédéric GRANAT
- Posts: 445
- Joined: Mon Nov 19, 2012 11:36 am
Re: Using time periods with services checks
Perfect,
So how could I define a Time Period on wednesday following the first tuesday of the month ?
Rgds,
Frederic
So how could I define a Time Period on wednesday following the first tuesday of the month ?
Rgds,
Frederic
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using time periods with services checks
Code: Select all
define timeperiod {
timeperiod_name mercredi_suivant_premier_mardi
alias Mercredi suivant le premier Mardi du mois
tuesday 1 - wednesday 1 00:00-24:00
exclude mardi
}
define timeperiod {
timeperiod_name mardi
alias mardi
tuesday 00:00-24:00
}
-
Frédéric GRANAT
- Posts: 445
- Joined: Mon Nov 19, 2012 11:36 am
Re: Using time periods with services checks
Does it work when the first wednesday of the month is before the first tuesday of the month ?
Rgds,
Frederic
Rgds,
Frederic
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using time periods with services checks
It should because this
means from the first Tuesday until the first Wednesday
Then we exclude Tuesday
Code: Select all
tuesday 1 - wednesday 1 00:00-24:00Then we exclude Tuesday
-
Frédéric GRANAT
- Posts: 445
- Joined: Mon Nov 19, 2012 11:36 am
Re: Using time periods with services checks
If wednesday 1 is after tuesday 1, the lenght of the period is 2 days, if you exclude tuesday, the period is the wednesday following the first tuesday : that's correct for me.
If wednesday 1 is before tuesday 1, the lenght of the periode is 7 days, if you exclude tuesday, the checks will occur during 6 days : that doesn't match with my need.
If your method doesn't work in that particular case, don't you have another way to solve the problem ?
Rgds,
Frederic
If wednesday 1 is before tuesday 1, the lenght of the periode is 7 days, if you exclude tuesday, the checks will occur during 6 days : that doesn't match with my need.
If your method doesn't work in that particular case, don't you have another way to solve the problem ?
Rgds,
Frederic
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using time periods with services checks
The method I posted should be correct.
The other scenerio you posted would be
If if fact you find it doesn't work, I do have another option and it would look like this
The other scenerio you posted would be
Code: Select all
wednesday 1 - tuesday 1 00:00-24:00Code: Select all
define timeperiod {
timeperiod_name mercredi_suivant_premier_mardi
alias Mercredi suivant le premier Mardi du mois
day 2 - 8 00:00-24:00
exclude everything_but_mardi
}
define timeperiod {
timeperiod_name everything_but_mardi
alias everything_but_mardi
monday 00:00-24:00
tuesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
sunday 00:00-24:00
}