IcingaDB: update icinga:nextupdate:* on Checkable#next_check changes

refs #7707
This commit is contained in:
Alexander A. Klimov 2019-12-10 15:41:04 +01:00
parent 77e02031f9
commit c6ea9bc7fe
2 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,9 @@ void IcingaDB::ConfigStaticInitialize()
Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr&, const MessageOrigin::Ptr&) { Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
IcingaDB::NewCheckResultHandler(checkable); IcingaDB::NewCheckResultHandler(checkable);
}); });
Checkable::OnNextCheckChanged.connect([](const Checkable::Ptr& checkable, const Value&) {
IcingaDB::NextCheckChangedHandler(checkable);
});
Service::OnHostProblemChanged.connect([](const Service::Ptr& service, const CheckResult::Ptr&, const MessageOrigin::Ptr&) { Service::OnHostProblemChanged.connect([](const Service::Ptr& service, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
IcingaDB::StateChangeHandler(service); IcingaDB::StateChangeHandler(service);
@ -2042,6 +2045,13 @@ void IcingaDB::NewCheckResultHandler(const Checkable::Ptr& checkable)
} }
} }
void IcingaDB::NextCheckChangedHandler(const Checkable::Ptr& checkable)
{
for (auto& rw : ConfigType::GetObjectsByType<IcingaDB>()) {
rw->m_WorkQueue.Enqueue([rw, checkable]() { rw->SendNextUpdate(checkable); });
}
}
struct AuthorComment struct AuthorComment
{ {
String Author; String Author;

View File

@ -108,6 +108,7 @@ private:
static void CommentRemovedHandler(const Comment::Ptr& comment); static void CommentRemovedHandler(const Comment::Ptr& comment);
static void FlappingChangeHandler(const Checkable::Ptr& checkable, double changeTime); static void FlappingChangeHandler(const Checkable::Ptr& checkable, double changeTime);
static void NewCheckResultHandler(const Checkable::Ptr& checkable); static void NewCheckResultHandler(const Checkable::Ptr& checkable);
static void NextCheckChangedHandler(const Checkable::Ptr& checkable);
static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry); static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, bool persistent, double changeTime, double expiry);
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime); static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, double changeTime);