mirror of https://github.com/Icinga/icinga2.git
parent
bb9b70d466
commit
798c56b809
|
@ -248,7 +248,20 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
|
|||
SetCheckAttempt(attempt);
|
||||
|
||||
ServiceState new_state = cr->GetState();
|
||||
SetStateRaw(new_state);
|
||||
|
||||
if (service) {
|
||||
SetStateRaw(new_state);
|
||||
} else {
|
||||
bool wasProblem = GetProblem();
|
||||
|
||||
SetStateRaw(new_state);
|
||||
|
||||
if (GetProblem() != wasProblem) {
|
||||
for (auto& service : host->GetServices()) {
|
||||
Service::OnHostProblemChanged(service, cr, origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool stateChange;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ using namespace icinga;
|
|||
|
||||
REGISTER_TYPE(Service);
|
||||
|
||||
boost::signals2::signal<void (const Service::Ptr&, const CheckResult::Ptr&, const MessageOrigin::Ptr&)> Service::OnHostProblemChanged;
|
||||
|
||||
String ServiceNameComposer::MakeName(const String& shortName, const Object::Ptr& context) const
|
||||
{
|
||||
Service::Ptr service = dynamic_pointer_cast<Service>(context);
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
|
||||
static void EvaluateApplyRules(const Host::Ptr& host);
|
||||
|
||||
static boost::signals2::signal<void (const Service::Ptr&, const CheckResult::Ptr&, const MessageOrigin::Ptr&)> OnHostProblemChanged;
|
||||
|
||||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
void CreateChildObjects(const Type::Ptr& childType) override;
|
||||
|
|
|
@ -94,6 +94,10 @@ void IcingaDB::ConfigStaticInitialize()
|
|||
Checkable::OnNewCheckResult.connect([](const Checkable::Ptr& checkable, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
|
||||
IcingaDB::NewCheckResultHandler(checkable);
|
||||
});
|
||||
|
||||
Service::OnHostProblemChanged.connect([](const Service::Ptr& service, const CheckResult::Ptr&, const MessageOrigin::Ptr&) {
|
||||
IcingaDB::StateChangeHandler(service);
|
||||
});
|
||||
}
|
||||
|
||||
void IcingaDB::UpdateAllConfigObjects()
|
||||
|
|
Loading…
Reference in New Issue