Merge pull request #7794 from Icinga/bugfix/icingadb-fix-last-update

IcingaDB: Fix last_update
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-01-31 12:12:49 +01:00 committed by GitHub
commit 431e4f64c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1896,7 +1896,10 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)
else
attrs->Set("check_timeout", TimestampToMilliseconds(checkable->GetCheckTimeout()));
attrs->Set("last_update", TimestampToMilliseconds(Utility::GetTime()));
long long lastCheck = TimestampToMilliseconds(checkable->GetLastCheck());
if (lastCheck > 0)
attrs->Set("last_update", lastCheck);
attrs->Set("last_state_change", TimestampToMilliseconds(checkable->GetLastStateChange()));
attrs->Set("next_check", TimestampToMilliseconds(checkable->GetNextCheck()));
attrs->Set("next_update", TimestampToMilliseconds(checkable->GetNextUpdate()));