Merge pull request #8101 from Icinga/bugfix/timestamps-checkresult-differ-across-nodes-8092

State timestamps set by the same check result differ across nodes
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-30 17:24:15 +01:00 committed by GitHub
commit 4f6fecc74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -209,7 +209,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
recovery = true; recovery = true;
ResetNotificationNumbers(); ResetNotificationNumbers();
SaveLastState(ServiceOK, Utility::GetTime()); SaveLastState(ServiceOK, cr->GetExecutionEnd());
/* update reachability for child objects in OK state */ /* update reachability for child objects in OK state */
if (!children.empty()) if (!children.empty())
@ -234,7 +234,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
} }
if (!IsStateOK(cr->GetState())) { if (!IsStateOK(cr->GetState())) {
SaveLastState(cr->GetState(), Utility::GetTime()); SaveLastState(cr->GetState(), cr->GetExecutionEnd());
} }
/* update reachability for child objects in NOT-OK state */ /* update reachability for child objects in NOT-OK state */
@ -243,7 +243,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
} }
if (!reachable) if (!reachable)
SetLastStateUnreachable(Utility::GetTime()); SetLastStateUnreachable(cr->GetExecutionEnd());
SetCheckAttempt(attempt); SetCheckAttempt(attempt);
@ -262,7 +262,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
SetPreviousStateChange(GetLastStateChange()); SetPreviousStateChange(GetLastStateChange());
if (stateChange) { if (stateChange) {
SetLastStateChange(now); SetLastStateChange(cr->GetExecutionEnd());
/* remove acknowledgements */ /* remove acknowledgements */
if (GetAcknowledgement() == AcknowledgementNormal || if (GetAcknowledgement() == AcknowledgementNormal ||
@ -299,7 +299,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (hardChange || is_volatile) { if (hardChange || is_volatile) {
SetLastHardStateRaw(new_state); SetLastHardStateRaw(new_state);
SetLastHardStateChange(now); SetLastHardStateChange(cr->GetExecutionEnd());
SetLastHardStatesRaw(GetLastHardStatesRaw() / 100u + new_state * 100u); SetLastHardStatesRaw(GetLastHardStatesRaw() / 100u + new_state * 100u);
} }