From a0359799bdcf4b34ed8f329209c293231030f0e2 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 18 Dec 2014 11:20:06 +0100 Subject: [PATCH] Compat: Fix event_handler_enabled dump based on enable_event_handler attribute fixes #8105 --- lib/compat/statusdatawriter.cpp | 7 ++++--- lib/icinga/compatutility.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp index 484852a8d..203947825 100644 --- a/lib/compat/statusdatawriter.cpp +++ b/lib/compat/statusdatawriter.cpp @@ -279,7 +279,7 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host) fp << "\t" "check_command" "\t" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(host) << "\n"; EventCommand::Ptr eventcommand = host->GetEventCommand(); - if (eventcommand) + if (eventcommand && host->GetEnableEventHandler()) fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n"; fp << "\t" "check_period" "\t" << CompatUtility::GetCheckableCheckPeriod(host) << "\n"; @@ -341,7 +341,8 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl "\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n" "\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n" "\t" "has_been_checked=" << CompatUtility::GetCheckableHasBeenChecked(checkable) << "\n" - "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"; + "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n" + "\t" "event_handler_enabled=" << CompatUtility::GetCheckableEventHandlerEnabled(checkable) << "\n"; if (cr) { fp << "\t" << "check_execution_time=" << Convert::ToString(Service::CalculateExecutionTime(cr)) << "\n" @@ -444,7 +445,7 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s fp << "\t" "check_command" "\t" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(service)<< "\n"; EventCommand::Ptr eventcommand = service->GetEventCommand(); - if (eventcommand) + if (eventcommand && service->GetEnableEventHandler()) fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n"; fp << "\t" "contacts" "\t"; diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 4e8ccd29b..fd2cd69ad 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -228,7 +228,7 @@ int CompatUtility::GetCheckableActiveChecksEnabled(const Checkable::Ptr& checkab int CompatUtility::GetCheckableEventHandlerEnabled(const Checkable::Ptr& checkable) { - return (checkable->GetEventCommand() ? 1 : 0); + return (checkable->GetEnableEventHandler() ? 1 : 0); } int CompatUtility::GetCheckableFlapDetectionEnabled(const Checkable::Ptr& checkable) -- 2.40.0