Skip to content
Permalink
Browse files

Move last_hard_state change to after event handler

Previously the last_hard_state was changed *after* the event handler in case of a service returning from critical->ok whereas it would be changed *before* the event handler in case of a service going from ok->critical.

This commit ensures that the behavior is consistent for both scenarios, and the last_hard_state is changed after the event handler is run.

The fixes issue #287 .
  • Loading branch information...
nook24 authored and jacobbaungard committed Apr 15, 2019
1 parent 5b196a6 commit 70758d2acf5dc67a57a8b16649312cfb8dabb390
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/naemon/checks_service.c
@@ -847,9 +847,7 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
if (state_change == TRUE || hard_state_change == TRUE)
temp_service->last_state_change = temp_service->last_check;
if (hard_state_change == TRUE) {
temp_service->last_hard_state_change = temp_service->last_check;
temp_service->state_type = HARD_STATE;
temp_service->last_hard_state = temp_service->current_state;
}

/* put service into a hard state without attempting check retries and don't send out notifications about it */
@@ -889,6 +887,10 @@ int handle_async_service_check_result(service *temp_service, check_result *queue

/* run the service event handler to handle the hard state */
handle_service_event(temp_service);

/* save the last hard state */
temp_service->last_hard_state_change = temp_service->last_check;
temp_service->last_hard_state = temp_service->current_state;
}
}

0 comments on commit 70758d2

Please sign in to comment.
You can’t perform that action at this time.