Merge pull request #6297 from Icinga/fix/eventhandler-ha-zone

Execute event commands only on actively checked host/service objects in an HA zone
This commit is contained in:
Michael Friedrich 2018-05-11 13:13:37 +02:00 committed by GitHub
commit f019153a12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,13 +41,20 @@ void Checkable::ExecuteEventHandler(const Dictionary::Ptr& resolvedMacros, bool
if (!IcingaApplication::GetInstance()->GetEnableEventHandlers() || !GetEnableEventHandler()) if (!IcingaApplication::GetInstance()->GetEnableEventHandlers() || !GetEnableEventHandler())
return; return;
/* HA enabled zones. */
if (IsActive() && IsPaused()) {
Log(LogNotice, "Checkable")
<< "Skipping event handler for HA-paused checkable '" << GetName() << "'";
return;
}
EventCommand::Ptr ec = GetEventCommand(); EventCommand::Ptr ec = GetEventCommand();
if (!ec) if (!ec)
return; return;
Log(LogNotice, "Checkable") Log(LogNotice, "Checkable")
<< "Executing event handler '" << ec->GetName() << "' for service '" << GetName() << "'"; << "Executing event handler '" << ec->GetName() << "' for checkable '" << GetName() << "'";
Dictionary::Ptr macros; Dictionary::Ptr macros;
Endpoint::Ptr endpoint = GetCommandEndpoint(); Endpoint::Ptr endpoint = GetCommandEndpoint();