From 70666aa6e0c18965402d18afd3302f93dc4efaed Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Mon, 5 Feb 2024 16:15:52 +0100 Subject: [PATCH] set problem_end only if it has started this solves an issue for the initial state change from pending to ok and when updating naemon from a version not supporting problem durations. --- src/naemon/checks_host.c | 3 ++- src/naemon/checks_service.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/naemon/checks_host.c b/src/naemon/checks_host.c index 244792b3..fc359eb2 100644 --- a/src/naemon/checks_host.c +++ b/src/naemon/checks_host.c @@ -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 */ diff --git a/src/naemon/checks_service.c b/src/naemon/checks_service.c index ad74f26b..6ac0febc 100644 --- a/src/naemon/checks_service.c +++ b/src/naemon/checks_service.c @@ -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; } }