mirror of https://github.com/Icinga/icinga2.git
parent
c123210529
commit
eba60b625f
|
@ -712,13 +712,14 @@ void ClusterListener::SetSecurityInfo(const Dictionary::Ptr& message, const Dyna
|
||||||
message->Set("security", security);
|
message->Set("security", security);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::CheckResultHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const String& authority)
|
void ClusterListener::CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("check_result", Serialize(cr));
|
params->Set("check_result", Serialize(cr));
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -726,18 +727,19 @@ void ClusterListener::CheckResultHandler(const Checkable::Ptr& service, const Ch
|
||||||
message->Set("method", "cluster::CheckResult");
|
message->Set("method", "cluster::CheckResult");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::NextCheckChangedHandler(const Checkable::Ptr& service, double nextCheck, const String& authority)
|
void ClusterListener::NextCheckChangedHandler(const Checkable::Ptr& checkable, double nextCheck, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("next_check", nextCheck);
|
params->Set("next_check", nextCheck);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -745,7 +747,7 @@ void ClusterListener::NextCheckChangedHandler(const Checkable::Ptr& service, dou
|
||||||
message->Set("method", "cluster::SetNextCheck");
|
message->Set("method", "cluster::SetNextCheck");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
@ -769,13 +771,14 @@ void ClusterListener::NextNotificationChangedHandler(const Notification::Ptr& no
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::ForceNextCheckChangedHandler(const Checkable::Ptr& service, bool forced, const String& authority)
|
void ClusterListener::ForceNextCheckChangedHandler(const Checkable::Ptr& checkable, bool forced, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("forced", forced);
|
params->Set("forced", forced);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -783,18 +786,19 @@ void ClusterListener::ForceNextCheckChangedHandler(const Checkable::Ptr& service
|
||||||
message->Set("method", "cluster::SetForceNextCheck");
|
message->Set("method", "cluster::SetForceNextCheck");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::ForceNextNotificationChangedHandler(const Checkable::Ptr& service, bool forced, const String& authority)
|
void ClusterListener::ForceNextNotificationChangedHandler(const Checkable::Ptr& checkable, bool forced, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("forced", forced);
|
params->Set("forced", forced);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -802,18 +806,19 @@ void ClusterListener::ForceNextNotificationChangedHandler(const Checkable::Ptr&
|
||||||
message->Set("method", "cluster::SetForceNextNotification");
|
message->Set("method", "cluster::SetForceNextNotification");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::EnableActiveChecksChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority)
|
void ClusterListener::EnableActiveChecksChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("enabled", enabled);
|
params->Set("enabled", enabled);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -821,18 +826,19 @@ void ClusterListener::EnableActiveChecksChangedHandler(const Checkable::Ptr& ser
|
||||||
message->Set("method", "cluster::SetEnableActiveChecks");
|
message->Set("method", "cluster::SetEnableActiveChecks");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::EnablePassiveChecksChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority)
|
void ClusterListener::EnablePassiveChecksChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("enabled", enabled);
|
params->Set("enabled", enabled);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -840,18 +846,19 @@ void ClusterListener::EnablePassiveChecksChangedHandler(const Checkable::Ptr& se
|
||||||
message->Set("method", "cluster::SetEnablePassiveChecks");
|
message->Set("method", "cluster::SetEnablePassiveChecks");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::EnableNotificationsChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority)
|
void ClusterListener::EnableNotificationsChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("enabled", enabled);
|
params->Set("enabled", enabled);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -859,18 +866,19 @@ void ClusterListener::EnableNotificationsChangedHandler(const Checkable::Ptr& se
|
||||||
message->Set("method", "cluster::SetEnableNotifications");
|
message->Set("method", "cluster::SetEnableNotifications");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::EnableFlappingChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority)
|
void ClusterListener::EnableFlappingChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("enabled", enabled);
|
params->Set("enabled", enabled);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -878,18 +886,19 @@ void ClusterListener::EnableFlappingChangedHandler(const Checkable::Ptr& service
|
||||||
message->Set("method", "cluster::SetEnableFlapping");
|
message->Set("method", "cluster::SetEnableFlapping");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::CommentAddedHandler(const Checkable::Ptr& service, const Comment::Ptr& comment, const String& authority)
|
void ClusterListener::CommentAddedHandler(const Checkable::Ptr& checkable, const Comment::Ptr& comment, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("comment", Serialize(comment));
|
params->Set("comment", Serialize(comment));
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -897,18 +906,19 @@ void ClusterListener::CommentAddedHandler(const Checkable::Ptr& service, const C
|
||||||
message->Set("method", "cluster::AddComment");
|
message->Set("method", "cluster::AddComment");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::CommentRemovedHandler(const Checkable::Ptr& service, const Comment::Ptr& comment, const String& authority)
|
void ClusterListener::CommentRemovedHandler(const Checkable::Ptr& checkable, const Comment::Ptr& comment, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("id", comment->GetId());
|
params->Set("id", comment->GetId());
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -916,18 +926,19 @@ void ClusterListener::CommentRemovedHandler(const Checkable::Ptr& service, const
|
||||||
message->Set("method", "cluster::RemoveComment");
|
message->Set("method", "cluster::RemoveComment");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::DowntimeAddedHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime, const String& authority)
|
void ClusterListener::DowntimeAddedHandler(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("downtime", Serialize(downtime));
|
params->Set("downtime", Serialize(downtime));
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -935,18 +946,19 @@ void ClusterListener::DowntimeAddedHandler(const Checkable::Ptr& service, const
|
||||||
message->Set("method", "cluster::AddDowntime");
|
message->Set("method", "cluster::AddDowntime");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::DowntimeRemovedHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime, const String& authority)
|
void ClusterListener::DowntimeRemovedHandler(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("id", downtime->GetId());
|
params->Set("id", downtime->GetId());
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -954,21 +966,22 @@ void ClusterListener::DowntimeRemovedHandler(const Checkable::Ptr& service, cons
|
||||||
message->Set("method", "cluster::RemoveDowntime");
|
message->Set("method", "cluster::RemoveDowntime");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::AcknowledgementSetHandler(const Checkable::Ptr& service, const String& author, const String& comment, AcknowledgementType type, double expiry, const String& authority)
|
void ClusterListener::AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, double expiry, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
params->Set("author", author);
|
params->Set("author", author);
|
||||||
params->Set("comment", comment);
|
params->Set("comment", comment);
|
||||||
params->Set("type", type);
|
params->Set("acktype", type);
|
||||||
params->Set("expiry", expiry);
|
params->Set("expiry", expiry);
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
|
@ -976,25 +989,26 @@ void ClusterListener::AcknowledgementSetHandler(const Checkable::Ptr& service, c
|
||||||
message->Set("method", "cluster::SetAcknowledgement");
|
message->Set("method", "cluster::SetAcknowledgement");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterListener::AcknowledgementClearedHandler(const Checkable::Ptr& service, const String& authority)
|
void ClusterListener::AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& authority)
|
||||||
{
|
{
|
||||||
if (!authority.IsEmpty() && authority != GetIdentity())
|
if (!authority.IsEmpty() && authority != GetIdentity())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Dictionary::Ptr params = make_shared<Dictionary>();
|
Dictionary::Ptr params = make_shared<Dictionary>();
|
||||||
params->Set("service", service->GetName());
|
params->Set("type", checkable->GetReflectionType()->GetName());
|
||||||
|
params->Set("checkable", checkable->GetName());
|
||||||
|
|
||||||
Dictionary::Ptr message = make_shared<Dictionary>();
|
Dictionary::Ptr message = make_shared<Dictionary>();
|
||||||
message->Set("jsonrpc", "2.0");
|
message->Set("jsonrpc", "2.0");
|
||||||
message->Set("method", "cluster::ClearAcknowledgement");
|
message->Set("method", "cluster::ClearAcknowledgement");
|
||||||
message->Set("params", params);
|
message->Set("params", params);
|
||||||
|
|
||||||
SetSecurityInfo(message, service, DomainPrivRead);
|
SetSecurityInfo(message, checkable, DomainPrivRead);
|
||||||
|
|
||||||
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
AsyncRelayMessage(Endpoint::Ptr(), message, true);
|
||||||
}
|
}
|
||||||
|
@ -1059,15 +1073,23 @@ void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictiona
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCheckResult)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::CheckResult message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCheckResult)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::CheckResult message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,154 +1098,210 @@ void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictiona
|
||||||
if (!cr)
|
if (!cr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
service->ProcessCheckResult(cr, sender->GetName());
|
checkable->ProcessCheckResult(cr, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetNextCheck") {
|
} else if (message->Get("method") == "cluster::SetNextCheck") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetNextCheck message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetNextCheck message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double nextCheck = params->Get("next_check");
|
double nextCheck = params->Get("next_check");
|
||||||
|
|
||||||
service->SetNextCheck(nextCheck, sender->GetName());
|
checkable->SetNextCheck(nextCheck, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetForceNextCheck") {
|
} else if (message->Get("method") == "cluster::SetForceNextCheck") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetForceNextCheck message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetForceNextCheck message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool forced = params->Get("forced");
|
bool forced = params->Get("forced");
|
||||||
|
|
||||||
service->SetForceNextCheck(forced, sender->GetName());
|
checkable->SetForceNextCheck(forced, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetForceNextNotification") {
|
} else if (message->Get("method") == "cluster::SetForceNextNotification") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetForceNextNotification message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetForceNextNotification message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool forced = params->Get("forced");
|
bool forced = params->Get("forced");
|
||||||
|
|
||||||
service->SetForceNextNotification(forced, sender->GetName());
|
checkable->SetForceNextNotification(forced, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetEnableActiveChecks") {
|
} else if (message->Get("method") == "cluster::SetEnableActiveChecks") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableActiveChecks message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableActiveChecks message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = params->Get("enabled");
|
bool enabled = params->Get("enabled");
|
||||||
|
|
||||||
service->SetEnableActiveChecks(enabled, sender->GetName());
|
checkable->SetEnableActiveChecks(enabled, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetEnablePassiveChecks") {
|
} else if (message->Get("method") == "cluster::SetEnablePassiveChecks") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetEnablePassiveChecks message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetEnablePassiveChecks message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = params->Get("enabled");
|
bool enabled = params->Get("enabled");
|
||||||
|
|
||||||
service->SetEnablePassiveChecks(enabled, sender->GetName());
|
checkable->SetEnablePassiveChecks(enabled, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetEnableNotifications") {
|
} else if (message->Get("method") == "cluster::SetEnableNotifications") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableNotifications message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableNotifications message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = params->Get("enabled");
|
bool enabled = params->Get("enabled");
|
||||||
|
|
||||||
service->SetEnableNotifications(enabled, sender->GetName());
|
checkable->SetEnableNotifications(enabled, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetEnableFlapping") {
|
} else if (message->Get("method") == "cluster::SetEnableFlapping") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableFlapping message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetEnableFlapping message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = params->Get("enabled");
|
bool enabled = params->Get("enabled");
|
||||||
|
|
||||||
service->SetEnableFlapping(enabled, sender->GetName());
|
checkable->SetEnableFlapping(enabled, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetNextNotification") {
|
} else if (message->Get("method") == "cluster::SetNextNotification") {
|
||||||
|
@ -1253,21 +1331,29 @@ void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictiona
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::AddComment message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::AddComment message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment::Ptr comment = Deserialize(params->Get("comment"), true);
|
Comment::Ptr comment = Deserialize(params->Get("comment"), true);
|
||||||
|
|
||||||
service->AddComment(comment->GetEntryType(), comment->GetAuthor(),
|
checkable->AddComment(comment->GetEntryType(), comment->GetAuthor(),
|
||||||
comment->GetText(), comment->GetExpireTime(), comment->GetId(), sender->GetName());
|
comment->GetText(), comment->GetExpireTime(), comment->GetId(), sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
|
@ -1275,42 +1361,58 @@ void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictiona
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::RemoveComment message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::RemoveComment message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String id = params->Get("id");
|
String id = params->Get("id");
|
||||||
|
|
||||||
service->RemoveComment(id, sender->GetName());
|
checkable->RemoveComment(id, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::AddDowntime") {
|
} else if (message->Get("method") == "cluster::AddDowntime") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::AddDowntime message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::AddDowntime message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Downtime::Ptr downtime = Deserialize(params->Get("downtime"), true);
|
Downtime::Ptr downtime = Deserialize(params->Get("downtime"), true);
|
||||||
|
|
||||||
service->AddDowntime(downtime->GetAuthor(), downtime->GetComment(),
|
checkable->AddDowntime(downtime->GetAuthor(), downtime->GetComment(),
|
||||||
downtime->GetStartTime(), downtime->GetEndTime(),
|
downtime->GetStartTime(), downtime->GetEndTime(),
|
||||||
downtime->GetFixed(), downtime->GetTriggeredBy(),
|
downtime->GetFixed(), downtime->GetTriggeredBy(),
|
||||||
downtime->GetDuration(), downtime->GetScheduledBy(),
|
downtime->GetDuration(), downtime->GetScheduledBy(),
|
||||||
|
@ -1321,66 +1423,90 @@ void ClusterListener::MessageHandler(const Endpoint::Ptr& sender, const Dictiona
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::RemoveDowntime message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::RemoveDowntime message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String id = params->Get("id");
|
String id = params->Get("id");
|
||||||
|
|
||||||
service->RemoveDowntime(id, false, sender->GetName());
|
checkable->RemoveDowntime(id, false, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::SetAcknowledgement") {
|
} else if (message->Get("method") == "cluster::SetAcknowledgement") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::SetAcknowledgement message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::SetAcknowledgement message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String author = params->Get("author");
|
String author = params->Get("author");
|
||||||
String comment = params->Get("comment");
|
String comment = params->Get("comment");
|
||||||
int type = params->Get("type");
|
int acktype = params->Get("acktype");
|
||||||
double expiry = params->Get("expiry");
|
double expiry = params->Get("expiry");
|
||||||
|
|
||||||
service->AcknowledgeProblem(author, comment, static_cast<AcknowledgementType>(type), expiry, sender->GetName());
|
checkable->AcknowledgeProblem(author, comment, static_cast<AcknowledgementType>(acktype), expiry, sender->GetName());
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
} else if (message->Get("method") == "cluster::ClearAcknowledgement") {
|
} else if (message->Get("method") == "cluster::ClearAcknowledgement") {
|
||||||
if (!params)
|
if (!params)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String svc = params->Get("service");
|
String type = params->Get("type");
|
||||||
|
String chk = params->Get("checkable");
|
||||||
|
|
||||||
Checkable::Ptr service = Checkable::GetByName(svc);
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
if (!service)
|
if (type == "Host")
|
||||||
|
checkable = DynamicObject::GetObject<Host>(chk);
|
||||||
|
else if (type == "Service")
|
||||||
|
checkable = DynamicObject::GetObject<Service>(chk);
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!service->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
if (!checkable)
|
||||||
Log(LogDebug, "cluster", "Not accepting cluster::ClearAcknowledgement message from endpoint '" + sender->GetName() + "' for service '" + service->GetName() + "': Insufficient privileges.");
|
return;
|
||||||
|
|
||||||
|
if (!checkable->HasPrivileges(sender->GetName(), DomainPrivCommand)) {
|
||||||
|
Log(LogDebug, "cluster", "Not accepting cluster::ClearAcknowledgement message from endpoint '" + sender->GetName() + "' for checkable '" + checkable->GetName() + "': Insufficient privileges.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(checkable);
|
||||||
service->ClearAcknowledgement(sender->GetName());
|
checkable->ClearAcknowledgement(sender->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncRelayMessage(sender, message, true);
|
AsyncRelayMessage(sender, message, true);
|
||||||
|
|
|
@ -87,21 +87,21 @@ private:
|
||||||
Stream::Ptr m_LogFile;
|
Stream::Ptr m_LogFile;
|
||||||
size_t m_LogMessageCount;
|
size_t m_LogMessageCount;
|
||||||
|
|
||||||
void CheckResultHandler(const Checkable::Ptr& service, const CheckResult::Ptr& cr, const String& authority);
|
void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const String& authority);
|
||||||
void NextCheckChangedHandler(const Checkable::Ptr& service, double nextCheck, const String& authority);
|
void NextCheckChangedHandler(const Checkable::Ptr& checkable, double nextCheck, const String& authority);
|
||||||
void NextNotificationChangedHandler(const Notification::Ptr& notification, double nextCheck, const String& authority);
|
void NextNotificationChangedHandler(const Notification::Ptr& notification, double nextCheck, const String& authority);
|
||||||
void ForceNextCheckChangedHandler(const Checkable::Ptr& service, bool forced, const String& authority);
|
void ForceNextCheckChangedHandler(const Checkable::Ptr& checkable, bool forced, const String& authority);
|
||||||
void ForceNextNotificationChangedHandler(const Checkable::Ptr& service, bool forced, const String& authority);
|
void ForceNextNotificationChangedHandler(const Checkable::Ptr& checkable, bool forced, const String& authority);
|
||||||
void EnableActiveChecksChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority);
|
void EnableActiveChecksChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority);
|
||||||
void EnablePassiveChecksChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority);
|
void EnablePassiveChecksChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority);
|
||||||
void EnableNotificationsChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority);
|
void EnableNotificationsChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority);
|
||||||
void EnableFlappingChangedHandler(const Checkable::Ptr& service, bool enabled, const String& authority);
|
void EnableFlappingChangedHandler(const Checkable::Ptr& checkable, bool enabled, const String& authority);
|
||||||
void CommentAddedHandler(const Checkable::Ptr& service, const Comment::Ptr& comment, const String& authority);
|
void CommentAddedHandler(const Checkable::Ptr& checkable, const Comment::Ptr& comment, const String& authority);
|
||||||
void CommentRemovedHandler(const Checkable::Ptr& service, const Comment::Ptr& comment, const String& authority);
|
void CommentRemovedHandler(const Checkable::Ptr& checkable, const Comment::Ptr& comment, const String& authority);
|
||||||
void DowntimeAddedHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime, const String& authority);
|
void DowntimeAddedHandler(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, const String& authority);
|
||||||
void DowntimeRemovedHandler(const Checkable::Ptr& service, const Downtime::Ptr& downtime, const String& authority);
|
void DowntimeRemovedHandler(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, const String& authority);
|
||||||
void AcknowledgementSetHandler(const Checkable::Ptr& service, const String& author, const String& comment, AcknowledgementType type, double expiry, const String& authority);
|
void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type, double expiry, const String& authority);
|
||||||
void AcknowledgementClearedHandler(const Checkable::Ptr& service, const String& authority);
|
void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& authority);
|
||||||
|
|
||||||
void AsyncMessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message);
|
void AsyncMessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message);
|
||||||
void MessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message);
|
void MessageHandler(const Endpoint::Ptr& sender, const Dictionary::Ptr& message);
|
||||||
|
|
Loading…
Reference in New Issue