From 3b108bba68cebed4c672c14416719322f6a0e568 Mon Sep 17 00:00:00 2001 From: rem31 <73845199+rem31@users.noreply.github.com> Date: Fri, 9 Apr 2021 11:54:02 +0200 Subject: [PATCH] =?UTF-8?q?fix(state)=20fix=20update=20last=5Fstate=5Fchan?= =?UTF-8?q?ge=20and=20last=5Fhard=5Fstate=5Fchange=20on=E2=80=A6=20(#480)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(state) fix update last_state_change and last_hard_state_change on host * chore(doc): release note updated. REFS: MON-6732 --- CHANGELOG.md | 2 ++ src/host.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2599cbd..7beca0ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ if they have no meaning, they are replaced by a default value. They could be sent twice. This new version fixes that. +fix update last_state_change and last_hard_state_change on host with no service + *Notification macros* The url encode action is removed from macros $HOSTACTIONURL*$, $HOSTNOTESURL*$, diff --git a/src/host.cc b/src/host.cc index bbdba0a74..51a335293 100755 --- a/src/host.cc +++ b/src/host.cc @@ -1277,6 +1277,12 @@ int host::handle_async_check_result_3x(check_result* queued_check_result) { return OK; } + /* initialize the last host state change times if necessary */ + if (get_last_state_change() == (time_t)0) + set_last_state_change(get_last_check()); + if (get_last_hard_state_change() == (time_t)0) + set_last_hard_state_change(get_last_check()); + /* was this check passive or active? */ set_check_type((queued_check_result->get_check_type() == check_active) ? check_active