"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "base/events.c" between
nagios-4.4.3.tar.gz and nagios-4.4.4.tar.gz

About: Nagios (Core) is an host/service/network monitoring system to identify and resolve IT infrastructure problems.

events.c  (nagios-4.4.3):events.c  (nagios-4.4.4)
skipping to change at line 351 skipping to change at line 351
log_debug_info(DEBUGL_EVENTS, 2, "CIB: %d, IBI: %d, TIB: %d, SIF: %d\n", current_interleave_block, interleave_block_index, total_interlea ve_blocks, scheduling_info.service_interleave_factor); log_debug_info(DEBUGL_EVENTS, 2, "CIB: %d, IBI: %d, TIB: %d, SIF: %d\n", current_interleave_block, interleave_block_index, total_interlea ve_blocks, scheduling_info.service_interleave_factor);
log_debug_info(DEBUGL_EVENTS, 2, "Mult factor: %d\n", mul t_factor); log_debug_info(DEBUGL_EVENTS, 2, "Mult factor: %d\n", mul t_factor);
/* /*
* set the preferred next check time for the service * set the preferred next check time for the service
* If we end up too far into the future, grab a random * If we end up too far into the future, grab a random
* time within the service's window instead. * time within the service's window instead.
*/ */
check_delay = check_delay =
mult_factor * scheduling_info.service_int er_check_delay; mult_factor * scheduling_info.service_int er_check_delay;
if(check_delay > check_window(temp_service)) { time_t check_window = reschedule_within_timeperiod(next_v
alid_time, temp_service->check_period_ptr, check_window(temp_service)) - current
_time;
if(check_delay > check_window) {
log_debug_info(DEBUGL_EVENTS, 0, log_debug_info(DEBUGL_EVENTS, 0,
" Fixing check time %lu secs too far away\n", " Fixing check time %lu secs too far away\n",
check_delay - check_window(temp_s ervice)); check_delay - check_window);
fixed_services++; fixed_services++;
check_delay = ranged_urand(0, check_window(temp_s ervice)); check_delay = check_window;
log_debug_info(DEBUGL_EVENTS, 0, " New check off set: %d\n", log_debug_info(DEBUGL_EVENTS, 0, " New check off set: %d\n",
check_delay); check_delay);
} }
temp_service->next_check = (time_t)(current_time + check_ delay); temp_service->next_check = (time_t)(current_time + check_ delay);
log_debug_info(DEBUGL_EVENTS, 2, "Preferred Check Time: % lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next _check)); log_debug_info(DEBUGL_EVENTS, 2, "Preferred Check Time: % lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next _check));
/* make sure the service can actually be scheduled when w e want */ /* make sure the service can actually be scheduled when w e want */
is_valid_time = check_time_against_period(temp_service->n ext_check, temp_service->check_period_ptr); is_valid_time = check_time_against_period(temp_service->n ext_check, temp_service->check_period_ptr);
if(is_valid_time == ERROR) { if(is_valid_time == ERROR) {
log_debug_info(DEBUGL_EVENTS, 2, "Preferred Time is Invalid In Timeperiod '%s': %lu --> %s\n", temp_service->check_period_ptr->na me, (unsigned long)temp_service->next_check, ctime(&temp_service->next_check)); log_debug_info(DEBUGL_EVENTS, 2, "Preferred Time is Invalid In Timeperiod '%s': %lu --> %s\n", temp_service->check_period_ptr->na me, (unsigned long)temp_service->next_check, ctime(&temp_service->next_check));
get_next_valid_time(temp_service->next_check, &ne xt_valid_time, temp_service->check_period_ptr); get_next_valid_time(temp_service->next_check, &ne xt_valid_time, temp_service->check_period_ptr);
temp_service->next_check = temp_service->next_check = reschedule_within_time
(time_t)(next_valid_time + check_ period(next_valid_time, temp_service->check_period_ptr, check_window(temp_servic
delay); e));
} }
log_debug_info(DEBUGL_EVENTS, 2, "Actual Check Time: %lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next_ch eck)); log_debug_info(DEBUGL_EVENTS, 2, "Actual Check Time: %lu --> %s\n", (unsigned long)temp_service->next_check, ctime(&temp_service->next_ch eck));
if(scheduling_info.first_service_check == (time_t)0 || (t emp_service->next_check < scheduling_info.first_service_check)) if(scheduling_info.first_service_check == (time_t)0 || (t emp_service->next_check < scheduling_info.first_service_check))
scheduling_info.first_service_check = temp_servic e->next_check; scheduling_info.first_service_check = temp_servic e->next_check;
if(temp_service->next_check > scheduling_info.last_servic e_check) if(temp_service->next_check > scheduling_info.last_servic e_check)
scheduling_info.last_service_check = temp_service ->next_check; scheduling_info.last_service_check = temp_service ->next_check;
} }
skipping to change at line 506 skipping to change at line 506
/* /*
* calculate preferred host check time. * calculate preferred host check time.
* If it's too far into the future, we grab a random time * If it's too far into the future, we grab a random time
* within this host's max check window instead * within this host's max check window instead
*/ */
check_delay = mult_factor * scheduling_info.host_inter_check_dela y; check_delay = mult_factor * scheduling_info.host_inter_check_dela y;
if(check_delay > check_window(temp_host)) { if(check_delay > check_window(temp_host)) {
log_debug_info(DEBUGL_EVENTS, 1, "Fixing check time (off by %lu)\n", log_debug_info(DEBUGL_EVENTS, 1, "Fixing check time (off by %lu)\n",
check_delay - check_window(temp_host)); check_delay - check_window(temp_host));
fixed_hosts++; fixed_hosts++;
check_delay = ranged_urand(0, check_window(temp_host)); check_delay = reschedule_within_timeperiod(next_valid_tim e, temp_host->check_period_ptr, check_window(temp_host));
} }
temp_host->next_check = (time_t)(current_time + check_delay); temp_host->next_check = (time_t)(current_time + check_delay);
log_debug_info(DEBUGL_EVENTS, 2, "Preferred Check Time: %lu --> % s", (unsigned long)temp_host->next_check, ctime(&temp_host->next_check)); log_debug_info(DEBUGL_EVENTS, 2, "Preferred Check Time: %lu --> % s", (unsigned long)temp_host->next_check, ctime(&temp_host->next_check));
/* make sure the host can actually be scheduled at this time */ /* make sure the host can actually be scheduled at this time */
is_valid_time = check_time_against_period(temp_host->next_check, temp_host->check_period_ptr); is_valid_time = check_time_against_period(temp_host->next_check, temp_host->check_period_ptr);
if(is_valid_time == ERROR) { if(is_valid_time == ERROR) {
get_next_valid_time(temp_host->next_check, &next_valid_ti me, temp_host->check_period_ptr); get_next_valid_time(temp_host->next_check, &next_valid_ti me, temp_host->check_period_ptr);
temp_host->next_check = (time_t)(next_valid_time | check_ delay); temp_host->next_check = (time_t)(next_valid_time | check_ delay);
skipping to change at line 1536 skipping to change at line 1536
* to timed_events for non-forced host or service checks. */ * to timed_events for non-forced host or service checks. */
sq_event = events_to_reschedule[i]; sq_event = events_to_reschedule[i];
temp_event = sq_event->data; temp_event = sq_event->data;
/* Calculate and apply a new queue 'when' time. */ /* Calculate and apply a new queue 'when' time. */
new_run_time.tv_sec = first_window_time + (time_t)floor(new_run_t ime_offset); new_run_time.tv_sec = first_window_time + (time_t)floor(new_run_t ime_offset);
new_run_time.tv_usec = (suseconds_t)(fmod(new_run_time_offset, 1. 0) * 1E6); new_run_time.tv_usec = (suseconds_t)(fmod(new_run_time_offset, 1. 0) * 1E6);
/* log_debug_info(DEBUGL_SCHEDULING, 2, "Check %d: offset %.3fs, new run time %lu.%06ld.\n", i, new_run_time_offset, (unsigned long)new_run_time.tv_ sec, (long)new_run_time.tv_usec); /* log_debug_info(DEBUGL_SCHEDULING, 2, "Check %d: offset %.3fs, new run time %lu.%06ld.\n", i, new_run_time_offset, (unsigned long)new_run_time.tv_ sec, (long)new_run_time.tv_usec);
*/ */
squeue_change_priority_tv(nagios_squeue, sq_event, &new_run_time)
;
if (temp_event->run_time != new_run_time.tv_sec)
temp_event->run_time = new_run_time.tv_sec;
/* 06/2019 - moved switch earlier in the for loop because we need to check against the check_period before rescheduling the event */
switch (temp_event->event_type) { switch (temp_event->event_type) {
case EVENT_HOST_CHECK: case EVENT_HOST_CHECK:
temp_host = temp_event->event_data; temp_host = temp_event->event_data;
if (check_time_against_period(new_run_time.tv_sec
, temp_host->check_period_ptr) == ERROR) {
continue;
}
if (temp_host->next_check != new_run_time.tv_sec) { if (temp_host->next_check != new_run_time.tv_sec) {
temp_host->next_check = new_run_time.tv_s ec; temp_host->next_check = new_run_time.tv_s ec;
temp_event->run_time = new_run_time.tv_se c;
update_host_status(temp_host, FALSE); update_host_status(temp_host, FALSE);
} }
break; break;
case EVENT_SERVICE_CHECK: case EVENT_SERVICE_CHECK:
temp_service = temp_event->event_data; temp_service = temp_event->event_data;
if (check_time_against_period(new_run_time.tv_sec
, temp_service->check_period_ptr) == ERROR) {
continue;
}
if (temp_service->next_check != new_run_time.tv_s ec) { if (temp_service->next_check != new_run_time.tv_s ec) {
temp_service->next_check = new_run_time.t v_sec; temp_service->next_check = new_run_time.t v_sec;
temp_event->run_time = new_run_time.tv_se c;
update_service_status(temp_service, FALSE ); update_service_status(temp_service, FALSE );
} }
break; break;
default: default:
break; break;
} }
}
squeue_change_priority_tv(nagios_squeue, sq_event, &new_run_time)
;
if (temp_event->run_time != new_run_time.tv_sec) {
temp_event->run_time = new_run_time.tv_sec;
}
} /* end for loop */
log_debug_info(DEBUGL_FUNCTIONS, 0, "adjust_check_scheduling() end\n"); log_debug_info(DEBUGL_FUNCTIONS, 0, "adjust_check_scheduling() end\n");
pqueue_free(temp_pqueue); pqueue_free(temp_pqueue);
free(events_to_reschedule); free(events_to_reschedule);
return; return;
} }
static void adjust_squeue_for_time_change(squeue_t **q, int delta) { static void adjust_squeue_for_time_change(squeue_t **q, int delta) {
timed_event *event; timed_event *event;
 End of changes. 12 change blocks. 
13 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)