[icinga-checkins] icinga.org: icinga2/feature/modified-attributes-4746: Implement override_enable_perfdata.

git at icinga.org git at icinga.org
Tue Nov 26 12:44:59 CET 2013


Module: icinga2
Branch: feature/modified-attributes-4746
Commit: ae3eaee1f4d0122e920a581e236498e11a344611
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=ae3eaee1f4d0122e920a581e236498e11a344611

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Nov 26 11:51:06 2013 +0100

Implement override_enable_perfdata.

Refs #4746

---

 lib/icinga/service.cpp |   19 +++++++++++++++++++
 lib/icinga/service.h   |    4 ++++
 lib/icinga/service.ti  |    7 ++++---
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp
index b1d05fb..1d3311f 100644
--- a/lib/icinga/service.cpp
+++ b/lib/icinga/service.cpp
@@ -260,6 +260,19 @@ std::set<Service::Ptr> Service::GetParentServices(void) const
 	return parents;
 }
 
+bool Service::GetEnablePerfdata(void) const
+{
+	if (!GetOverrideEnablePerfdata().IsEmpty())
+		return GetOverrideEnablePerfdata();
+	else
+		return GetEnablePerfdataRaw();
+}
+
+void Service::SetEnablePerfdata(bool enabled, const String& authority)
+{
+	SetOverrideEnablePerfdata(enabled);
+}
+
 int Service::GetModifiedAttributes(void) const
 {
 	int attrs = 0;
@@ -279,6 +292,9 @@ int Service::GetModifiedAttributes(void) const
 	if (!GetOverrideEnableEventHandler().IsEmpty())
 		attrs |= ModAttrEventHandlerEnabled;
 
+	if (!GetOverrideEnablePerfdata().IsEmpty())
+		attrs |= ModAttrPerformanceDataEnabled;
+
 	if (!GetOverrideCheckInterval().IsEmpty())
 		attrs |= ModAttrNormalCheckInterval;
 
@@ -307,6 +323,9 @@ void Service::SetModifiedAttributes(int flags)
 	if ((flags & ModAttrEventHandlerEnabled) == 0)
 		SetOverrideEnableEventHandler(Empty);
 
+	if ((flags & ModAttrPerformanceDataEnabled) == 0)
+		SetOverrideEnablePerfdata(Empty);
+
 	if ((flags & ModAttrNormalCheckInterval) == 0)
 		SetOverrideCheckInterval(Empty);
 
diff --git a/lib/icinga/service.h b/lib/icinga/service.h
index c11e0ea..458410b 100644
--- a/lib/icinga/service.h
+++ b/lib/icinga/service.h
@@ -249,6 +249,10 @@ public:
 	bool IsFlapping(void) const;
 	void UpdateFlappingStatus(bool stateChange);
 
+	/* Performance data */
+	bool GetEnablePerfdata(void) const;
+	void SetEnablePerfdata(bool enabled, const String& authority = String());
+
 protected:
 	virtual void Start(void);
 
diff --git a/lib/icinga/service.ti b/lib/icinga/service.ti
index 9fadc75..f3f9c36 100644
--- a/lib/icinga/service.ti
+++ b/lib/icinga/service.ti
@@ -74,6 +74,9 @@ class Service : DynamicObject
 	[config] bool enable_flapping (EnableFlappingRaw) {
 		default {{{ return true; }}}
 	};
+	[config] bool enable_perfdata (EnablePerfdataRaw) {
+		default {{{ return true; }}}
+	};
 
 	[state] double next_check (NextCheckRaw);
 	[state] int check_attempt {
@@ -125,13 +128,11 @@ class Service : DynamicObject
 	[state] int flapping_positive;
 	[state] int flapping_negative;
 	[state] double flapping_last_change;
-	[state] bool enable_perfdata {
-		default {{{ return true; }}}
-	};
 	[state] Value override_enable_notifications;
 	[state] Value override_enable_active_checks;
 	[state] Value override_enable_passive_checks;
 	[state] Value override_enable_flapping;
+	[state] Value override_enable_perfdata;
 	[state] Value override_check_interval;
 	[state] Value override_retry_interval;
 	[state] Value override_enable_event_handler;





More information about the icinga-checkins mailing list