mirror of https://github.com/Icinga/icinga2.git
Connect IcingaDB::UpdateState to Checkable::OnNewCheckResult instead of calling it in IcingaDB#SendEvent()
This commit is contained in:
parent
cef4c46ba8
commit
efa548fbdf
|
@ -102,6 +102,7 @@ void IcingaDB::ConfigStaticInitialize()
|
|||
Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
|
||||
IcingaDB::NewCheckResultHandler(checkable);
|
||||
});
|
||||
|
||||
Checkable::OnNextCheckChanged.connect([](const Checkable::Ptr& checkable, const Value&) {
|
||||
IcingaDB::NextCheckChangedHandler(checkable);
|
||||
});
|
||||
|
@ -2044,6 +2045,7 @@ void IcingaDB::FlappingChangeHandler(const Checkable::Ptr& checkable, double cha
|
|||
void IcingaDB::NewCheckResultHandler(const Checkable::Ptr& checkable)
|
||||
{
|
||||
for (auto& rw : ConfigType::GetObjectsByType<IcingaDB>()) {
|
||||
rw->UpdateState(checkable);
|
||||
rw->SendNextUpdate(checkable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,19 +193,6 @@ void IcingaDB::SendEvent(const Dictionary::Ptr& event)
|
|||
|
||||
String type = event->Get("type");
|
||||
|
||||
if (type == "CheckResult") {
|
||||
Checkable::Ptr checkable;
|
||||
|
||||
if (event->Contains("service")) {
|
||||
checkable = Service::GetByNamePair(event->Get("host"), event->Get("service"));
|
||||
} else {
|
||||
checkable = Host::GetByName(event->Get("host"));
|
||||
}
|
||||
|
||||
// Update State for icingaweb
|
||||
m_WorkQueue.Enqueue([this, checkable]() { UpdateState(checkable); });
|
||||
}
|
||||
|
||||
if (type.Contains("Acknowledgement")) {
|
||||
Checkable::Ptr checkable;
|
||||
|
||||
|
|
Loading…
Reference in New Issue