[icinga-checkins] icinga.org: icinga2/master: StatusDataWriter: Fix wrong host notification filters

git at icinga.org git at icinga.org
Sat Feb 7 22:47:07 CET 2015


Module: icinga2
Branch: master
Commit: 9302a6d03c3440619e192c7c1b06b6d6761ffd0e
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=9302a6d03c3440619e192c7c1b06b6d6761ffd0e

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Sat Feb  7 22:46:34 2015 +0100

StatusDataWriter: Fix wrong host notification filters

fixes #8387
refs #8192

---

 lib/icinga/compatutility.cpp |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp
index ab06027..6885601 100644
--- a/lib/icinga/compatutility.cpp
+++ b/lib/icinga/compatutility.cpp
@@ -544,6 +544,11 @@ String CompatUtility::GetCheckableNotificationNotificationPeriod(const Checkable
 
 String CompatUtility::GetCheckableNotificationNotificationOptions(const Checkable::Ptr& checkable)
 {
+
+	Host::Ptr host;
+	Service::Ptr service;
+	tie(host, service) = GetHostService(checkable);
+
 	unsigned long notification_type_filter = 0;
 	unsigned long notification_state_filter = 0;
 
@@ -555,14 +560,20 @@ String CompatUtility::GetCheckableNotificationNotificationOptions(const Checkabl
 	std::vector<String> notification_options;
 
 	/* notification state filters */
-	if (notification_state_filter & (1<<ServiceWarning)) {
-		notification_options.push_back("w");
-	}
-	if (notification_state_filter & (1<<ServiceUnknown)) {
-		notification_options.push_back("u");
-	}
-	if (notification_state_filter & (1<<ServiceCritical)) {
-		notification_options.push_back("c");
+	if (service) {
+		if (notification_state_filter & (1<<ServiceWarning)) {
+			notification_options.push_back("w");
+		}
+		if (notification_state_filter & (1<<ServiceUnknown)) {
+			notification_options.push_back("u");
+		}
+		if (notification_state_filter & (1<<ServiceCritical)) {
+			notification_options.push_back("c");
+		}
+	} else {
+		if (notification_state_filter & (1<<HostDown)) {
+			notification_options.push_back("d");
+		}
 	}
 
 	/* notification type filters */



More information about the icinga-checkins mailing list