diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 773396f2b..bb7f7ff9b 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -45,6 +45,7 @@ boost::signals2::signal Checkable::OnEnableFlappingChanged; boost::signals2::signal Checkable::OnCheckIntervalChanged; boost::signals2::signal Checkable::OnRetryIntervalChanged; +boost::signals2::signal Checkable::OnCheckCommandChanged; boost::signals2::signal Checkable::OnFlappingChanged; CheckCommand::Ptr Checkable::GetCheckCommand(void) const @@ -59,9 +60,11 @@ CheckCommand::Ptr Checkable::GetCheckCommand(void) const return CheckCommand::GetByName(command); } -void Checkable::SetCheckCommand(const CheckCommand::Ptr& command) +void Checkable::SetCheckCommand(const CheckCommand::Ptr& command, const MessageOrigin& origin) { SetOverrideCheckCommand(command->GetName()); + + OnCheckCommandChanged(GetSelf(), command, origin); } TimePeriod::Ptr Checkable::GetCheckPeriod(void) const diff --git a/lib/icinga/checkable-event.cpp b/lib/icinga/checkable-event.cpp index 867bb2e23..a126b282f 100644 --- a/lib/icinga/checkable-event.cpp +++ b/lib/icinga/checkable-event.cpp @@ -27,6 +27,7 @@ using namespace icinga; boost::signals2::signal Checkable::OnEventCommandExecuted; boost::signals2::signal Checkable::OnEnableEventHandlerChanged; +boost::signals2::signal Checkable::OnEventCommandChanged; bool Checkable::GetEnableEventHandler(void) const { @@ -55,9 +56,11 @@ EventCommand::Ptr Checkable::GetEventCommand(void) const return EventCommand::GetByName(command); } -void Checkable::SetEventCommand(const EventCommand::Ptr& command) +void Checkable::SetEventCommand(const EventCommand::Ptr& command, const MessageOrigin& origin) { SetOverrideEventCommand(command->GetName()); + + OnEventCommandChanged(GetSelf(), command, origin); } void Checkable::ExecuteEventHandler(void) diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index d40f2e743..96517847d 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -98,7 +98,7 @@ public: /* Checks */ shared_ptr GetCheckCommand(void) const; - void SetCheckCommand(const shared_ptr& command); + void SetCheckCommand(const shared_ptr& command, const MessageOrigin& origin = MessageOrigin()); TimePeriod::Ptr GetCheckPeriod(void) const; void SetCheckPeriod(const TimePeriod::Ptr& tp); @@ -157,6 +157,8 @@ public: static boost::signals2::signal OnEnableEventHandlerChanged; static boost::signals2::signal OnCheckIntervalChanged; static boost::signals2::signal OnRetryIntervalChanged; + static boost::signals2::signal&, const MessageOrigin&)> OnEventCommandChanged; + static boost::signals2::signal&, const MessageOrigin&)> OnCheckCommandChanged; static boost::signals2::signal OnNewCheckResult; static boost::signals2::signal OnStateChange; @@ -240,7 +242,7 @@ public: void ExecuteEventHandler(void); shared_ptr GetEventCommand(void) const; - void SetEventCommand(const shared_ptr& command); + void SetEventCommand(const shared_ptr& command, const MessageOrigin& origin = MessageOrigin()); bool GetEnableEventHandler(void) const; void SetEnableEventHandler(bool enabled, const MessageOrigin& origin = MessageOrigin());