Icinga DB: introduce Checkable#last_comment_id

This commit is contained in:
Alexander A. Klimov 2021-07-29 12:15:00 +02:00
parent 173a93c487
commit 5c10fffa3b

View File

@ -1895,6 +1895,8 @@ void IcingaDB::SendAddedComment(const Comment::Ptr& comment)
} }
m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History); m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History);
UpdateState(checkable);
SendStatusUpdate(checkable);
} }
void IcingaDB::SendRemovedComment(const Comment::Ptr& comment) void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
@ -1962,6 +1964,8 @@ void IcingaDB::SendRemovedComment(const Comment::Ptr& comment)
} }
m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History); m_Rcon->FireAndForgetQuery(std::move(xAdd), Prio::History);
UpdateState(checkable);
SendStatusUpdate(checkable);
} }
void IcingaDB::SendFlappingChange(const Checkable::Ptr& checkable, double changeTime, double flappingLastChange) void IcingaDB::SendFlappingChange(const Checkable::Ptr& checkable, double changeTime, double flappingLastChange)
@ -2253,6 +2257,14 @@ Dictionary::Ptr IcingaDB::SerializeState(const Checkable::Ptr& checkable)
} }
} }
{
auto lastComment (checkable->GetLastComment());
if (lastComment) {
attrs->Set("last_comment_id", GetObjectIdentifier(lastComment));
}
}
attrs->Set("in_downtime", checkable->IsInDowntime()); attrs->Set("in_downtime", checkable->IsInDowntime());
if (checkable->GetCheckTimeout().IsEmpty()) if (checkable->GetCheckTimeout().IsEmpty())