cluster: Log ignored messages.

This commit is contained in:
Gunnar Beutner 2013-09-17 14:58:52 +02:00
parent 74579fba59
commit 48ec2dfd08
1 changed files with 92 additions and 15 deletions

View File

@ -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,9 +1172,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->SetEnableFlapping(enabled, sender->GetName());
@ -1153,9 +1193,16 @@ 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");
notification->SetNextNotification(nextNotification, sender->GetName());
@ -1169,9 +1216,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 comment = params->Get("comment");
long type = static_cast<long>(comment->Get("entry_type"));
@ -1187,9 +1239,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 id = params->Get("id");
service->RemoveComment(id, sender->GetName());
@ -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,9 +1284,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 id = params->Get("id");
service->RemoveDowntime(id, sender->GetName());
@ -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());