"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "base/checks.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.

checks.c  (nagios-4.4.3):checks.c  (nagios-4.4.4)
skipping to change at line 134 skipping to change at line 134
/* this service could be rescheduled... */ /* this service could be rescheduled... */
else { else {
svc->next_check = next_valid_time; svc->next_check = next_valid_time;
if (next_valid_time > preferred_time) { if (next_valid_time > preferred_time) {
/* Next valid time is further in the futu re because of /* Next valid time is further in the futu re because of
* timeperiod constraints. Add a random a mount so we * timeperiod constraints. Add a random a mount so we
* don't get all checks subject to that t imeperiod * don't get all checks subject to that t imeperiod
* constraint scheduled at the same time * constraint scheduled at the same time
*/ */
svc->next_check += ranged_urand(0, check_ window(svc)); svc->next_check = reschedule_within_timep eriod(next_valid_time, svc->check_period_ptr, check_window(svc));
} }
svc->should_be_scheduled = TRUE; svc->should_be_scheduled = TRUE;
log_debug_info(DEBUGL_CHECKS, 1, "Rescheduled nex t service check for %s", ctime(&next_valid_time)); log_debug_info(DEBUGL_CHECKS, 1, "Rescheduled nex t service check for %s", ctime(&next_valid_time));
} }
} }
/* /*
* reschedule the next service check - unless we couldn't * reschedule the next service check - unless we couldn't
* find a valid next check time, but keep original options * find a valid next check time, but keep original options
skipping to change at line 304 skipping to change at line 304
#ifdef USE_EVENT_BROKER #ifdef USE_EVENT_BROKER
/* send data to event broker */ /* send data to event broker */
neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_ NONE, NEBATTR_NONE, svc, CHECK_TYPE_ACTIVE, start_time, end_time, svc->check_com mand, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NUL L, cr); neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_ NONE, NEBATTR_NONE, svc, CHECK_TYPE_ACTIVE, start_time, end_time, svc->check_com mand, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NUL L, cr);
/* neb module wants to override the service check - perhaps it will check the service itself */ /* neb module wants to override the service check - perhaps it will check the service itself */
if (neb_result == NEBERROR_CALLBACKOVERRIDE) { if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
clear_volatile_macros_r(&mac); clear_volatile_macros_r(&mac);
svc->latency = old_latency; svc->latency = old_latency;
free_check_result(cr); free_check_result(cr);
my_free(cr);
my_free(processed_command); my_free(processed_command);
return OK; return OK;
} }
#endif #endif
/* reset latency (permanent value will be set later) */ /* reset latency (permanent value will be set later) */
svc->latency = old_latency; svc->latency = old_latency;
/* paw off the check to a worker to run */ /* paw off the check to a worker to run */
runchk_result = wproc_run_check(cr, processed_command, &mac); runchk_result = wproc_run_check(cr, processed_command, &mac);
skipping to change at line 699 skipping to change at line 700
} }
hst->is_executing = FALSE; hst->is_executing = FALSE;
} }
/****************************************************************************** /******************************************************************************
******* Generic debugging functions ******* Generic debugging functions
*****************************************************************************/ *****************************************************************************/
static inline void debug_async_service(service *svc, check_result *cr) static inline void debug_async_service(service *svc, check_result *cr)
{ {
log_debug_info(DEBUGL_CHECKS, 0, "** Handling %s async check result for s ervice '%s' on host '%s' from '%s'...\n", log_debug_info(DEBUGL_CHECKS, 0, "** Handling %s async check result for s ervice '%s' on host '%s' from '%s'... current state %d last_hard_state %d \n",
(cr->check_type == CHECK_TYPE_ACTIVE) ? "ACTIVE" : "PASSIVE", (cr->check_type == CHECK_TYPE_ACTIVE) ? "ACTIVE" : "PASSIVE",
svc->description, svc->description,
svc->host_name, svc->host_name,
check_result_source(cr)); check_result_source(cr),
svc->current_state,
svc->last_hard_state);
log_debug_info(DEBUGL_CHECKS, 1, log_debug_info(DEBUGL_CHECKS, 1,
" * OPTIONS: %d, SCHEDULED: %d, RESCHEDULE: %d, EXITED OK: %d, RE TURN CODE: %d, OUTPUT:\n%s\n", " * OPTIONS: %d, SCHEDULED: %d, RESCHEDULE: %d, EXITED OK: %d, RE TURN CODE: %d, OUTPUT:\n%s\n",
cr->check_options, cr->check_options,
cr->scheduled_check, cr->scheduled_check,
cr->reschedule_check, cr->reschedule_check,
cr->exited_ok, cr->exited_ok,
cr->return_code, cr->return_code,
(cr == NULL) ? "NULL" : cr->output); (cr == NULL) ? "NULL" : cr->output);
} }
skipping to change at line 1212 skipping to change at line 1215
if (svc == NULL) { if (svc == NULL) {
log_debug_info(DEBUGL_CHECKS, 2, "No service specified, bailing!\ n"); log_debug_info(DEBUGL_CHECKS, 2, "No service specified, bailing!\ n");
return ERROR; return ERROR;
} }
hst = svc->host_ptr; hst = svc->host_ptr;
if (is_valid_check_result_data(hst, cr) == FALSE) { if (is_valid_check_result_data(hst, cr) == FALSE) {
return ERROR; return ERROR;
} }
int new_last_hard_state = svc->last_hard_state;
if (cr->check_type == CHECK_TYPE_PASSIVE) { if (cr->check_type == CHECK_TYPE_PASSIVE) {
if (service_is_passive(svc, cr) == FALSE) { if (service_is_passive(svc, cr) == FALSE) {
return ERROR; return ERROR;
} }
} }
else { else {
service_is_active(svc); service_is_active(svc);
} }
time(&current_time); time(&current_time);
skipping to change at line 1336 skipping to change at line 1341
/* possibly re-send host notifications... */ /* possibly re-send host notifications... */
host_notification(hst, NOTIFICATION_NORMAL, NULL, NULL, NOTIFICATION_OPTION_NONE); host_notification(hst, NOTIFICATION_NORMAL, NULL, NULL, NOTIFICATION_OPTION_NONE);
} }
svc->host_problem_at_last_check = TRUE; svc->host_problem_at_last_check = TRUE;
} }
} }
/* service hard state change, because if host is down/unreachable /* service hard state change, because if host is down/unreachable
the docs say we have a hard state change (but no notification) */ the docs say we have a hard state change (but no notification) */
if (hst->current_state != HOST_UP && svc->last_hard_state != svc->current _state) { if (hst->current_state != HOST_UP && new_last_hard_state != svc->current_ state) {
log_debug_info(DEBUGL_CHECKS, 2, "Host is down or unreachable, fo rcing service hard state change\n"); log_debug_info(DEBUGL_CHECKS, 2, "Host is down or unreachable, fo rcing service hard state change\n");
hard_state_change = TRUE; hard_state_change = TRUE;
svc->state_type = HARD_STATE; svc->state_type = HARD_STATE;
svc->last_hard_state = svc->current_state; new_last_hard_state = svc->current_state;
svc->current_attempt = svc->max_attempts;
} }
if (check_host == TRUE) { if (check_host == TRUE) {
schedule_host_check(hst, current_time, CHECK_OPTION_DEPENDENCY_CH ECK); schedule_host_check(hst, current_time, CHECK_OPTION_DEPENDENCY_CH ECK);
} }
if (update_host_stats == TRUE) { if (update_host_stats == TRUE) {
update_check_stats(ACTIVE_ONDEMAND_HOST_CHECK_STATS, current_time ); update_check_stats(ACTIVE_ONDEMAND_HOST_CHECK_STATS, current_time );
update_check_stats(ACTIVE_CACHED_HOST_CHECK_STATS, current_time); update_check_stats(ACTIVE_CACHED_HOST_CHECK_STATS, current_time);
} }
skipping to change at line 1481 skipping to change at line 1487
} }
/* otherwise, just increase the attempt */ /* otherwise, just increase the attempt */
else if (svc->current_attempt < svc->max_attempts) { else if (svc->current_attempt < svc->max_attempts) {
svc->current_attempt++; svc->current_attempt++;
} }
} }
if (svc->current_attempt >= svc->max_attempts && if (svc->current_attempt >= svc->max_attempts &&
(svc->current_state != svc->last_hard_state || svc->state_type == SOFT_STATE)) { (svc->current_state != new_last_hard_state || svc->state_type == SOFT_STATE)) {
log_debug_info(DEBUGL_CHECKS, 2, "Service had a HARD STATE CHANGE !!\n"); log_debug_info(DEBUGL_CHECKS, 2, "Service had a HARD STATE CHANGE !!\n");
next_check = (unsigned long)(current_time + (svc->check_interval * inter val_length)); next_check = (unsigned long)(current_time + (svc->check_interval * inter val_length));
/* set both states changed, this may have been missed... */ /* set both states changed, this may have been missed... */
hard_state_change = TRUE; hard_state_change = TRUE;
/* this is missed earlier */ /* this is missed earlier */
send_notification = TRUE; send_notification = TRUE;
} }
/* handle some acknowledgement things and update last_state_change */ /* handle some acknowledgement things and update last_state_change */
/* This is a temporary fix that lets us avoid changing any function bound
aries in a bugfix release */
/* @fixme 4.5.0 - refactor so that each specific struct member is only mo
dified in */
/* service_state_or_hard_state_type_change() or handle_async_service_chec
k_result(), not both.*/
int original_last_hard_state = svc->last_hard_state;
service_state_or_hard_state_type_change(svc, state_change, hard_state_cha nge, &log_event, &handle_event); service_state_or_hard_state_type_change(svc, state_change, hard_state_cha nge, &log_event, &handle_event);
if (original_last_hard_state != svc->last_hard_state) {
/* svc->last_hard_state now gets written only after the service s
tatus is brokered */
new_last_hard_state = svc->last_hard_state;
svc->last_hard_state = original_last_hard_state;
}
/* fix edge cases where log_event wouldn't have been set or won't be */ /* fix edge cases where log_event wouldn't have been set or won't be */
if (svc->current_state != STATE_OK && svc->state_type == SOFT_STATE) { if (svc->current_state != STATE_OK && svc->state_type == SOFT_STATE) {
log_event = TRUE; log_event = TRUE;
} }
record_last_service_state_ended(svc); record_last_service_state_ended(svc);
check_for_service_flapping(svc, TRUE, TRUE); check_for_service_flapping(svc, TRUE, TRUE);
check_for_host_flapping(hst, TRUE, FALSE, TRUE); check_for_host_flapping(hst, TRUE, FALSE, TRUE);
skipping to change at line 1539 skipping to change at line 1555
/* make sure we rescheduled the next service check at a valid tim e */ /* make sure we rescheduled the next service check at a valid tim e */
preferred_time = svc->next_check; preferred_time = svc->next_check;
get_next_valid_time(preferred_time, &next_valid_time, svc->check_ period_ptr); get_next_valid_time(preferred_time, &next_valid_time, svc->check_ period_ptr);
svc->next_check = next_valid_time; svc->next_check = next_valid_time;
/* Next valid time is further in the future because of timeperiod /* Next valid time is further in the future because of timeperiod
constraints. Add a random amount so we don't get all checks constraints. Add a random amount so we don't get all checks
subject to that timeperiod constraint scheduled at the same ti me */ subject to that timeperiod constraint scheduled at the same ti me */
if (next_valid_time > preferred_time) { if (next_valid_time > preferred_time) {
svc->next_check += ranged_urand(0, check_window(svc)); svc->next_check = reschedule_within_timeperiod(next_valid _time, svc->check_period_ptr, check_window(svc));
} }
schedule_service_check(svc, svc->next_check, CHECK_OPTION_NONE); schedule_service_check(svc, svc->next_check, CHECK_OPTION_NONE);
} }
/* volatile service gets everything in non-ok hard state */ /* volatile service gets everything in non-ok hard state */
if ((svc->current_state != STATE_OK) if ((svc->current_state != STATE_OK)
&& (svc->state_type == HARD_STATE) && (svc->state_type == HARD_STATE)
&& (svc->is_volatile == TRUE)) { && (svc->is_volatile == TRUE)) {
skipping to change at line 1591 skipping to change at line 1607
log_debug_info(DEBUGL_CHECKS, 2, "Logging due to state stalking, old: [%s], new: [%s]\n", old_plugin_output, svc->plugin_output); log_debug_info(DEBUGL_CHECKS, 2, "Logging due to state stalking, old: [%s], new: [%s]\n", old_plugin_output, svc->plugin_output);
log_event = TRUE; log_event = TRUE;
} }
if (log_event == TRUE) { if (log_event == TRUE) {
log_service_event(svc); log_service_event(svc);
} }
if (handle_event == TRUE) { if (handle_event == TRUE) {
log_debug_info(DEBUGL_CHECKS, 0, "IS TIME FOR HANDLE THE SERVICE
KTHX");
debug_async_service(svc, cr);
handle_service_event(svc); handle_service_event(svc);
} }
/* Update OK states since they send out a soft alert but then they /* Update OK states since they send out a soft alert but then they
switch into a HARD state and reset the attempts */ switch into a HARD state and reset the attempts */
if (svc->current_state == STATE_OK && state_change == TRUE) { if (svc->current_state == STATE_OK && state_change == TRUE) {
/* Reset attempts and problem state */ /* Problem state starts regardless of SOFT/HARD status. */
svc->last_problem_id = svc->current_problem_id;
svc->current_problem_id = 0L;
/* Reset attempts */
if (hard_state_change == TRUE) { if (hard_state_change == TRUE) {
svc->last_problem_id = svc->current_problem_id;
svc->current_problem_id = 0L;
svc->current_notification_number = 0; svc->current_notification_number = 0;
svc->host_problem_at_last_check = FALSE; svc->host_problem_at_last_check = FALSE;
} }
/* Set OK to a hard state */
svc->last_hard_state_change = svc->last_check; svc->last_hard_state_change = svc->last_check;
svc->last_hard_state = svc->current_state; new_last_hard_state = svc->current_state;
/* Set OK to a hard state */
svc->current_attempt = 1; svc->current_attempt = 1;
svc->state_type = HARD_STATE; svc->state_type = HARD_STATE;
} }
log_debug_info(DEBUGL_CHECKS, 2, log_debug_info(DEBUGL_CHECKS, 2,
"STATE: %d, TYPE: %s, CUR: %d, MAX: %d, LAST_STATE: %d, LAST_HARD : %d, NOTIFY: %d, LOGGED: %d, HANDLED: %d\n", "STATE: %d, TYPE: %s, CUR: %d, MAX: %d, LAST_STATE: %d, LAST_HARD : %d, NOTIFY: %d, LOGGED: %d, HANDLED: %d\n",
svc->current_state, svc->current_state,
(svc->state_type == SOFT_STATE) ? "SOFT" : "HARD", (svc->state_type == SOFT_STATE) ? "SOFT" : "HARD",
svc->current_attempt, svc->current_attempt,
svc->max_attempts, svc->max_attempts,
skipping to change at line 1633 skipping to change at line 1655
handle_event); handle_event);
#ifdef USE_EVENT_BROKER #ifdef USE_EVENT_BROKER
broker_service_check(NEBTYPE_SERVICECHECK_PROCESSED, NEBFLAG_NONE, NEBATT R_NONE, svc, svc->check_type, cr->start_time, cr->finish_time, NULL, svc->latenc y, svc->execution_time, service_check_timeout, cr->early_timeout, cr->return_cod e, NULL, NULL, cr); broker_service_check(NEBTYPE_SERVICECHECK_PROCESSED, NEBFLAG_NONE, NEBATT R_NONE, svc, svc->check_type, cr->start_time, cr->finish_time, NULL, svc->latenc y, svc->execution_time, service_check_timeout, cr->early_timeout, cr->return_cod e, NULL, NULL, cr);
#endif #endif
svc->has_been_checked = TRUE; svc->has_been_checked = TRUE;
update_service_status(svc, FALSE); update_service_status(svc, FALSE);
update_service_performance_data(svc); update_service_performance_data(svc);
/* last_hard_state cleanup
* This occurs after being brokered so that last_hard_state refers to the
previous logged hard state,
* rather than the current hard state
*/
svc->last_hard_state = new_last_hard_state;
my_free(old_plugin_output); my_free(old_plugin_output);
return OK; return OK;
} }
/* schedules an immediate or delayed service check */ /* schedules an immediate or delayed service check */
inline void schedule_service_check(service *svc, time_t check_time, int options) inline void schedule_service_check(service *svc, time_t check_time, int options)
{ {
timed_event *temp_event = NULL; timed_event *temp_event = NULL;
int use_original_event = TRUE; int use_original_event = TRUE;
skipping to change at line 2204 skipping to change at line 2232
int log_event = FALSE; int log_event = FALSE;
char * old_plugin_output = NULL; char * old_plugin_output = NULL;
log_debug_info(DEBUGL_FUNCTIONS, 0, "handle_async_host_check_result()\n") ; log_debug_info(DEBUGL_FUNCTIONS, 0, "handle_async_host_check_result()\n") ;
if (is_valid_check_result_data(hst, cr) == FALSE) { if (is_valid_check_result_data(hst, cr) == FALSE) {
return ERROR; return ERROR;
} }
int new_last_hard_state = hst->last_hard_state;
if (cr->check_type == CHECK_TYPE_PASSIVE) { if (cr->check_type == CHECK_TYPE_PASSIVE) {
if (host_is_passive(hst, cr) == FALSE) { if (host_is_passive(hst, cr) == FALSE) {
return ERROR; return ERROR;
} }
} }
else { else {
host_is_active(hst); host_is_active(hst);
} }
time(&current_time); time(&current_time);
initialize_last_host_state_change_times(hst); initialize_last_host_state_change_times(hst);
skipping to change at line 2356 skipping to change at line 2386
else if (state_change == TRUE || hst->current_state == HOST_UP) { else if (state_change == TRUE || hst->current_state == HOST_UP) {
hst->current_attempt = 1; hst->current_attempt = 1;
} }
/* or increment if we can */ /* or increment if we can */
else if (hst->current_attempt < hst->max_attempts) { else if (hst->current_attempt < hst->max_attempts) {
hst->current_attempt++; hst->current_attempt++;
} }
} }
if (hst->current_attempt >= hst->max_attempts && hst->current_state != hs t->last_hard_state) { if (hst->current_attempt >= hst->max_attempts && hst->current_state != ne w_last_hard_state) {
log_debug_info(DEBUGL_CHECKS, 2, "Host had a HARD STATE CHANGE!!\ n"); log_debug_info(DEBUGL_CHECKS, 2, "Host had a HARD STATE CHANGE!!\ n");
next_check = (unsigned long)(current_time + (hst->check_interval * interval_length)); next_check = (unsigned long)(current_time + (hst->check_interval * interval_length));
hard_state_change = TRUE; hard_state_change = TRUE;
send_notification = TRUE; send_notification = TRUE;
} }
/* handle some acknowledgement things and update last_state_change */ /* handle some acknowledgement things and update last_state_change */
/* @fixme 4.5.0 - See similar comment in handle_async_service_check_resul
t() */
int original_last_hard_state = hst->last_hard_state;
host_state_or_hard_state_type_change(hst, state_change, hard_state_change , &log_event, &handle_event, &send_notification); host_state_or_hard_state_type_change(hst, state_change, hard_state_change , &log_event, &handle_event, &send_notification);
if (original_last_hard_state != hst->last_hard_state) {
/* svc->last_hard_state now gets written only after the service s
tatus is brokered */
new_last_hard_state = hst->last_hard_state;
hst->last_hard_state = original_last_hard_state;
}
record_last_host_state_ended(hst); record_last_host_state_ended(hst);
check_for_host_flapping(hst, TRUE, TRUE, TRUE); check_for_host_flapping(hst, TRUE, TRUE, TRUE);
/* host with active checks disabled do not get rescheduled */ /* host with active checks disabled do not get rescheduled */
if (hst->checks_enabled == FALSE) { if (hst->checks_enabled == FALSE) {
hst->should_be_scheduled = FALSE; hst->should_be_scheduled = FALSE;
} }
skipping to change at line 2405 skipping to change at line 2443
/* make sure we rescheduled the next service check at a valid tim e */ /* make sure we rescheduled the next service check at a valid tim e */
preferred_time = hst->next_check; preferred_time = hst->next_check;
get_next_valid_time(preferred_time, &next_valid_time, hst->check_ period_ptr); get_next_valid_time(preferred_time, &next_valid_time, hst->check_ period_ptr);
hst->next_check = next_valid_time; hst->next_check = next_valid_time;
/* Next valid time is further in the future because of timeperiod /* Next valid time is further in the future because of timeperiod
constraints. Add a random amount so we don't get all checks constraints. Add a random amount so we don't get all checks
subject to that timeperiod constraint scheduled at the same ti me */ subject to that timeperiod constraint scheduled at the same ti me */
if (next_valid_time > preferred_time) { if (next_valid_time > preferred_time) {
hst->next_check += ranged_urand(0, check_window(hst)); hst->next_check = reschedule_within_timeperiod(next_valid _time, hst->check_period_ptr, check_window(hst));
} }
schedule_host_check(hst, hst->next_check, CHECK_OPTION_NONE); schedule_host_check(hst, hst->next_check, CHECK_OPTION_NONE);
} }
if (hst->current_attempt == HOST_UP) { if (hst->current_attempt == HOST_UP) {
hst->current_attempt = 1; hst->current_attempt = 1;
} }
if (send_notification == TRUE) { if (send_notification == TRUE) {
skipping to change at line 2475 skipping to change at line 2513
handle_event); handle_event);
#ifdef USE_EVENT_BROKER #ifdef USE_EVENT_BROKER
broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE , hst, hst->check_type, hst->current_state, hst->state_type, cr->start_time, cr- >finish_time, hst->check_command, hst->latency, hst->execution_time, host_check_ timeout, cr->early_timeout, cr->return_code, NULL, hst->plugin_output, hst->long _plugin_output, hst->perf_data, NULL, cr); broker_host_check(NEBTYPE_HOSTCHECK_PROCESSED, NEBFLAG_NONE, NEBATTR_NONE , hst, hst->check_type, hst->current_state, hst->state_type, cr->start_time, cr- >finish_time, hst->check_command, hst->latency, hst->execution_time, host_check_ timeout, cr->early_timeout, cr->return_code, NULL, hst->plugin_output, hst->long _plugin_output, hst->perf_data, NULL, cr);
#endif #endif
hst->has_been_checked = TRUE; hst->has_been_checked = TRUE;
update_host_status(hst, FALSE); update_host_status(hst, FALSE);
update_host_performance_data(hst); update_host_performance_data(hst);
/* last_hard_state cleanup
* This occurs after being brokered so that last_hard_state refers to the
previous logged hard state,
* rather than the current hard state
*/
hst->last_hard_state = new_last_hard_state;
/* free memory */ /* free memory */
my_free(old_plugin_output); my_free(old_plugin_output);
return OK; return OK;
} }
/******************************************************************/ /******************************************************************/
/*************** COMMON ROUTE/HOST CHECK FUNCTIONS ****************/ /*************** COMMON ROUTE/HOST CHECK FUNCTIONS ****************/
/******************************************************************/ /******************************************************************/
skipping to change at line 2967 skipping to change at line 3011
/* make sure we rescheduled the next host check at a vali d time */ /* make sure we rescheduled the next host check at a vali d time */
get_next_valid_time(preferred_time, &next_valid_time, hst ->check_period_ptr); get_next_valid_time(preferred_time, &next_valid_time, hst ->check_period_ptr);
/* /*
* If the host really can't be rescheduled properly we * If the host really can't be rescheduled properly we
* set next check time to preferred_time and try again th en * set next check time to preferred_time and try again th en
*/ */
if ((time_is_valid == FALSE) if ((time_is_valid == FALSE)
&& (check_time_against_period(next_valid_time, hs t->check_period_ptr) == ERROR)) { && (check_time_against_period(next_valid_time, hs t->check_period_ptr) == ERROR)) {
hst->next_check = preferred_time + ranged_urand(0 , check_window(hst)); hst->next_check = reschedule_within_timeperiod(ne xt_valid_time, hst->check_period_ptr, check_window(hst));
logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Chec k of host '%s' could not be rescheduled properly. Scheduling check for %s...\n" , hst->name, ctime(&preferred_time)); logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Chec k of host '%s' could not be rescheduled properly. Scheduling check for %s...\n" , hst->name, ctime(&preferred_time));
log_debug_info(DEBUGL_CHECKS, 1, "Unable to find any valid times to reschedule the next host check!\n"); log_debug_info(DEBUGL_CHECKS, 1, "Unable to find any valid times to reschedule the next host check!\n");
} }
/* this service could be rescheduled... */ /* this service could be rescheduled... */
else { else {
hst->next_check = next_valid_time; hst->next_check = next_valid_time;
if (next_valid_time > preferred_time) { if (next_valid_time > preferred_time) {
/* Next valid time is further in the futu re because of /* Next valid time is further in the futu re because of
* timeperiod constraints. Add a random a mount so we * timeperiod constraints. Add a random a mount so we
* don't get all checks subject to that t imeperiod * don't get all checks subject to that t imeperiod
* constraint scheduled at the same time * constraint scheduled at the same time
*/ */
hst->next_check += ranged_urand(0, check_ window(hst)); hst->next_check = reschedule_within_timep eriod(next_valid_time, hst->check_period_ptr, check_window(hst));
} }
hst->should_be_scheduled = TRUE; hst->should_be_scheduled = TRUE;
log_debug_info(DEBUGL_CHECKS, 1, "Rescheduled nex t host check for %s", ctime(&next_valid_time)); log_debug_info(DEBUGL_CHECKS, 1, "Rescheduled nex t host check for %s", ctime(&next_valid_time));
} }
} }
/* update the status log */ /* update the status log */
update_host_status(hst, FALSE); update_host_status(hst, FALSE);
skipping to change at line 3153 skipping to change at line 3197
#ifdef USE_EVENT_BROKER #ifdef USE_EVENT_BROKER
/* send data to event broker */ /* send data to event broker */
neb_result = broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, CHECK_TYPE_ACTIVE, hst->current_state, hst->state_type, start _time, end_time, hst->check_command, hst->latency, 0.0, host_check_timeout, FALS E, 0, processed_command, NULL, NULL, NULL, NULL, cr); neb_result = broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, CHECK_TYPE_ACTIVE, hst->current_state, hst->state_type, start _time, end_time, hst->check_command, hst->latency, 0.0, host_check_timeout, FALS E, 0, processed_command, NULL, NULL, NULL, NULL, cr);
/* neb module wants to override the service check - perhaps it will check the service itself */ /* neb module wants to override the service check - perhaps it will check the service itself */
if (neb_result == NEBERROR_CALLBACKOVERRIDE) { if (neb_result == NEBERROR_CALLBACKOVERRIDE) {
clear_volatile_macros_r(&mac); clear_volatile_macros_r(&mac);
hst->latency = old_latency; hst->latency = old_latency;
free_check_result(cr); free_check_result(cr);
my_free(cr);
my_free(processed_command); my_free(processed_command);
return OK; return OK;
} }
#endif #endif
/* reset latency (permanent value for this check will get set later) */ /* reset latency (permanent value for this check will get set later) */
hst->latency = old_latency; hst->latency = old_latency;
runchk_result = wproc_run_check(cr, processed_command, &mac); runchk_result = wproc_run_check(cr, processed_command, &mac);
if (runchk_result == ERROR) { if (runchk_result == ERROR) {
 End of changes. 26 change blocks. 
16 lines changed or deleted 70 lines changed or added

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