diff --git a/components/perfdata/graphitewriter.cpp b/components/perfdata/graphitewriter.cpp index 9f10d5bf5..ab01a2f07 100644 --- a/components/perfdata/graphitewriter.cpp +++ b/components/perfdata/graphitewriter.cpp @@ -94,7 +94,7 @@ void GraphiteWriter::ReconnectTimerHandler(void) void GraphiteWriter::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr) { - if (!IcingaApplication::GetInstance()->GetEnablePerfdata()) + if (!IcingaApplication::GetInstance()->GetEnablePerfdata() || !service->GetEnablePerfdata()) return; Host::Ptr host = service->GetHost(); diff --git a/components/perfdata/perfdatawriter.cpp b/components/perfdata/perfdatawriter.cpp index c67b144c3..6d9282dd1 100644 --- a/components/perfdata/perfdatawriter.cpp +++ b/components/perfdata/perfdatawriter.cpp @@ -84,7 +84,7 @@ double PerfdataWriter::GetRotationInterval(void) const void PerfdataWriter::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr) { - if (!IcingaApplication::GetInstance()->GetEnablePerfdata()) + if (!IcingaApplication::GetInstance()->GetEnablePerfdata() || !service->GetEnablePerfdata()) return; Host::Ptr host = service->GetHost(); diff --git a/lib/icinga/service-event.cpp b/lib/icinga/service-event.cpp index 8482252a7..9714c906c 100644 --- a/lib/icinga/service-event.cpp +++ b/lib/icinga/service-event.cpp @@ -25,6 +25,11 @@ using namespace icinga; boost::signals2::signal Service::OnEventCommandExecuted; +bool Service::GetEnableEventHandlers(void) const +{ + return m_EnableEventHandlers; +} + EventCommand::Ptr Service::GetEventCommand(void) const { return EventCommand::GetByName(m_EventCommand); @@ -32,7 +37,7 @@ EventCommand::Ptr Service::GetEventCommand(void) const void Service::ExecuteEventHandler(void) { - if (!IcingaApplication::GetInstance()->GetEnableEventHandlers()) + if (!IcingaApplication::GetInstance()->GetEnableEventHandlers() || !GetEnableEventHandlers()) return; EventCommand::Ptr ec = GetEventCommand(); diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 52bba4cfb..0bf0a68a8 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -328,6 +328,11 @@ std::set Service::GetParentServices(void) const return parents; } +bool Service::GetEnablePerfdata(void) const +{ + return m_EnablePerfdata; +} + bool Service::ResolveMacro(const String& macro, const Dictionary::Ptr& cr, String *result) const { if (macro == "SERVICEDESC") { @@ -460,6 +465,8 @@ void Service::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) bag->Set("flapping_negative", m_FlappingNegative); bag->Set("flapping_lastchange", m_FlappingLastChange); bag->Set("enable_flapping", m_EnableFlapping); + bag->Set("enable_perfdata", m_EnablePerfdata); + bag->Set("enable_event_handlers", m_EnableEventHandlers); } } @@ -518,5 +525,7 @@ void Service::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes m_FlappingNegative = bag->Get("flapping_negative"); m_FlappingLastChange = bag->Get("flapping_lastchange"); m_EnableFlapping = bag->Get("enable_flapping"); + m_EnablePerfdata = bag->Get("enable_perfdata"); + m_EnableEventHandlers = bag->Get("enable_event_handlers"); } } diff --git a/lib/icinga/service.h b/lib/icinga/service.h index 0371f79d7..1d61444da 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -213,6 +213,8 @@ public: bool GetEnablePassiveChecks(void) const; void SetEnablePassiveChecks(bool enabled, const String& authority = String()); + bool GetEnablePerfdata(void) const; + bool GetForceNextCheck(void) const; void SetForceNextCheck(bool forced, const String& authority = String()); @@ -323,6 +325,7 @@ public: /* Event Handler */ void ExecuteEventHandler(void); shared_ptr GetEventCommand(void) const; + bool GetEnableEventHandlers(void) const; /* Flapping Detection */ bool GetEnableFlapping(void) const; @@ -353,6 +356,7 @@ private: Value m_AcknowledgementExpiry; String m_HostName; Value m_Volatile; + Value m_EnablePerfdata; /* Checks */ String m_CheckCommand; @@ -412,6 +416,7 @@ private: std::set m_Notifications; /* Event Handler */ + Value m_EnableEventHandlers; String m_EventCommand; /* Flapping */