[icinga-checkins] icinga.org: icinga2/master: cluster: Log ignored messages.

git at icinga.org git at icinga.org
Tue Sep 17 14:59:01 CEST 2013


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

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Sep 17 14:58:52 2013 +0200

cluster: Log ignored messages.

---

 components/cluster/clustercomponent.cpp |  107 ++++++++++++++++++++++++++-----
 1 file changed, 92 insertions(+), 15 deletions(-)

diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp
index 2027afa..fc49648 100644
--- a/components/cluster/clustercomponent.cpp
+++ b/components/cluster/clustercomponent.cpp
@@ -1022,9 +1022,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		Dictionary::Ptr cr = params->Get("check_result");
 
 		if (!cr)
@@ -1041,9 +1046,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		double nextCheck = params->Get("next_check");
 
 		service->SetNextCheck(nextCheck, sender->GetName());
@@ -1057,9 +1067,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		bool forced = params->Get("forced");
 
 		service->SetForceNextCheck(forced, sender->GetName());
@@ -1073,9 +1088,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		bool forced = params->Get("forced");
 
 		service->SetForceNextNotification(forced, sender->GetName());
@@ -1089,9 +1109,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		bool enabled = params->Get("enabled");
 
 		service->SetEnableActiveChecks(enabled, sender->GetName());
@@ -1105,9 +1130,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		bool enabled = params->Get("enabled");
 
 		service->SetEnablePassiveChecks(enabled, sender->GetName());
@@ -1121,9 +1151,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		bool enabled = params->Get("enabled");
 
 		service->SetEnableNotifications(enabled, sender->GetName());
@@ -1137,8 +1172,13 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
+			return;
+
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
 			return;
+		}
 
 		bool enabled = params->Get("enabled");
 
@@ -1153,8 +1193,15 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Notification::Ptr notification = Notification::GetByName(nfc);
 
-		if (!notification || !notification->GetService()->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!notification)
+			return;
+
+		Service::Ptr service = notification->GetService();
+
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
 			return;
+		}
 
 		bool nextNotification = params->Get("next_notification");
 
@@ -1169,8 +1216,13 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
+			return;
+
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
 			return;
+		}
 
 		Dictionary::Ptr comment = params->Get("comment");
 
@@ -1187,8 +1239,13 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
+			return;
+
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
 			return;
+		}
 
 		String id = params->Get("id");
 
@@ -1203,9 +1260,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		Dictionary::Ptr downtime = params->Get("downtime");
 
 		service->AddDowntime(downtime->Get("comment_id"),
@@ -1222,8 +1284,13 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
+			return;
+
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
 			return;
+		}
 
 		String id = params->Get("id");
 
@@ -1238,9 +1305,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		String author = params->Get("author");
 		String comment = params->Get("comment");
 		int type = params->Get("type");
@@ -1257,9 +1329,14 @@ void ClusterComponent::MessageHandler(const Endpoint::Ptr& sender, const Diction
 
 		Service::Ptr service = Service::GetByName(svc);
 
-		if (!service || !service->HasPrivileges(sender->GetName(), DomainPrivCommand))
+		if (!service)
 			return;
 
+		if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
+			Log(LogDebug, "cluster", "Not accepting message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
+			return;
+		}
+
 		{
 			ObjectLock olock(service);
 			service->ClearAcknowledgement(sender->GetName());





More information about the icinga-checkins mailing list