Re: [Nagios-devel] Strange service scheduling [PATCH]
Posted: Fri Apr 03, 2009 12:17 pm
--========GMX249311238764620261308
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
-------- Original-Nachricht --------
> Datum: Thu, 2 Apr 2009 13:44:15 -0300 (BRT)
> Von: Ricardo Maraschini
> An: Nagios Developers List
> Betreff: Re: [Nagios-devel] Strange service scheduling
> Follow attached.
>
> -rm
Hi Ricardo,
I've tested your patch and it works fine. Thanks!
The rescheduling works fine now for
- The scheduled check tim is not in time period after modifying time period
- System time has changed ("Warning: A system time change ...
(backwards in time) has been detected. Compensating...")
before the service check enters its (positive) time period again
I think we should handle the host checks the same way.
I've modified the behavior when the checks still can't be rescheduled properly: The check is scheduled a week in the future. Additionally, the failing reschedule is written to the event log, so we can see if something's going wrong.
The patch includes Ricardos patch and my changes described above.
Regards
Bernd
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
--========GMX249311238764620261308
Content-Type: text/x-patch; charset="iso-8859-15"; name="patch2.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="patch2.diff"
--- checks.c 2009-04-03 14:50:47.000000000 +0200
+++ checks.c 2009-04-03 15:04:26.000000000 +0200
@@ -277,13 +277,14 @@
preferred_time=current_time+((svc->check_intervalcheck_interval*interval_length));
/* make sure we rescheduled the next service check at a valid time */
- get_next_valid_time(preferred_time,&next_valid_time,svc->check_period_ptr);
+ get_next_valid_time(current_time,&next_valid_time,svc->check_period_ptr);
- /* the service could not be rescheduled properly - set the next check time for next year, but don't actually reschedule it */
+ /* the service could not be rescheduled properly - set the next check time for next week */
if(time_is_valid==FALSE && next_valid_time==preferred_time){
- svc->next_check=(time_t)(next_valid_time+(60*60*24*365));
- svc->should_be_scheduled=FALSE;
+ svc->next_check=(time_t)(next_valid_time+(60*60*24*7));
+
+ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Check of service '%s' (host '%s') could not be rescheduled properly. Scheduling check for next week...\n",svc->display_name,svc->host_name);
log_debug_info(DEBUGL_CHECKS,1,"Unable to find any valid times to reschedule the next service check!\n");
}
@@ -2792,13 +2793,14 @@
preferred_time=current_time+((hst->check_intervalcheck_interval*interval_length));
/* make sure we rescheduled the next host check at a valid time */
- get_next_valid_time(preferred_time,&next_valid_time,hst->check_period_ptr);
+ get_next_valid_time(current_time,&next_valid_time,hst->check_period_ptr);
- /* the host could not be rescheduled properly - set the next check time for next year, but don't actually reschedule it */
+ /* the host could not be rescheduled properly - set the next check time for next week */
if(time_is_valid==FALSE && next_valid_time==preferred_time){
- hst->next_check=(time_t)(next_valid_time+(60*60*24*365));
- hst->should_be_scheduled=FALSE;
+ hst->next_check=(time_t)(next_valid_time+(60*60*24*7));
+
+ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Check of host '%s' could not be rescheduled properly. Scheduling check for next week...\n",hst->display_name);
log_debug_info(DEBUGL_CHECKS,1,"Unable to find any valid times to reschedule the next host check!\n");
}
--========GMX249311238764620261308--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
-------- Original-Nachricht --------
> Datum: Thu, 2 Apr 2009 13:44:15 -0300 (BRT)
> Von: Ricardo Maraschini
> An: Nagios Developers List
> Betreff: Re: [Nagios-devel] Strange service scheduling
> Follow attached.
>
> -rm
Hi Ricardo,
I've tested your patch and it works fine. Thanks!
The rescheduling works fine now for
- The scheduled check tim is not in time period after modifying time period
- System time has changed ("Warning: A system time change ...
(backwards in time) has been detected. Compensating...")
before the service check enters its (positive) time period again
I think we should handle the host checks the same way.
I've modified the behavior when the checks still can't be rescheduled properly: The check is scheduled a week in the future. Additionally, the failing reschedule is written to the event log, so we can see if something's going wrong.
The patch includes Ricardos patch and my changes described above.
Regards
Bernd
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
--========GMX249311238764620261308
Content-Type: text/x-patch; charset="iso-8859-15"; name="patch2.diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="patch2.diff"
--- checks.c 2009-04-03 14:50:47.000000000 +0200
+++ checks.c 2009-04-03 15:04:26.000000000 +0200
@@ -277,13 +277,14 @@
preferred_time=current_time+((svc->check_intervalcheck_interval*interval_length));
/* make sure we rescheduled the next service check at a valid time */
- get_next_valid_time(preferred_time,&next_valid_time,svc->check_period_ptr);
+ get_next_valid_time(current_time,&next_valid_time,svc->check_period_ptr);
- /* the service could not be rescheduled properly - set the next check time for next year, but don't actually reschedule it */
+ /* the service could not be rescheduled properly - set the next check time for next week */
if(time_is_valid==FALSE && next_valid_time==preferred_time){
- svc->next_check=(time_t)(next_valid_time+(60*60*24*365));
- svc->should_be_scheduled=FALSE;
+ svc->next_check=(time_t)(next_valid_time+(60*60*24*7));
+
+ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Check of service '%s' (host '%s') could not be rescheduled properly. Scheduling check for next week...\n",svc->display_name,svc->host_name);
log_debug_info(DEBUGL_CHECKS,1,"Unable to find any valid times to reschedule the next service check!\n");
}
@@ -2792,13 +2793,14 @@
preferred_time=current_time+((hst->check_intervalcheck_interval*interval_length));
/* make sure we rescheduled the next host check at a valid time */
- get_next_valid_time(preferred_time,&next_valid_time,hst->check_period_ptr);
+ get_next_valid_time(current_time,&next_valid_time,hst->check_period_ptr);
- /* the host could not be rescheduled properly - set the next check time for next year, but don't actually reschedule it */
+ /* the host could not be rescheduled properly - set the next check time for next week */
if(time_is_valid==FALSE && next_valid_time==preferred_time){
- hst->next_check=(time_t)(next_valid_time+(60*60*24*365));
- hst->should_be_scheduled=FALSE;
+ hst->next_check=(time_t)(next_valid_time+(60*60*24*7));
+
+ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Check of host '%s' could not be rescheduled properly. Scheduling check for next week...\n",hst->display_name);
log_debug_info(DEBUGL_CHECKS,1,"Unable to find any valid times to reschedule the next host check!\n");
}
--========GMX249311238764620261308--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]