Skip to content

Commit

Permalink
set problem_end only if it has started
Browse files Browse the repository at this point in the history
this solves an issue for the initial state change from pending to ok and
when updating naemon from a version not supporting problem durations.
  • Loading branch information
sni committed Feb 5, 2024
1 parent 225f8ed commit 70666aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/naemon/checks_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,8 @@ static int handle_host_state(host *hst, int *alert_recorded)
if (hst->current_state == STATE_UP) {
hst->last_problem_id = hst->current_problem_id;
hst->current_problem_id = NULL;
hst->problem_end = current_time;
if(hst->problem_start > 0)
hst->problem_end = current_time;
}

/* write the host state change to the main log file */
Expand Down
3 changes: 2 additions & 1 deletion src/naemon/checks_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
if (temp_service->current_state == STATE_OK) {
temp_service->last_problem_id = temp_service->current_problem_id;
temp_service->current_problem_id = NULL;
temp_service->problem_end = current_time;
if(temp_service->problem_start > 0)
temp_service->problem_end = current_time;
}
}

Expand Down

0 comments on commit 70666aa

Please sign in to comment.