Don't allow acknowledgements for services that are OK.

This commit is contained in:
Gunnar Beutner 2013-01-23 16:18:58 +01:00
parent 495caa664a
commit 116e420167
1 changed files with 6 additions and 0 deletions

View File

@ -271,6 +271,9 @@ void ExternalCommand::AcknowledgeSvcProblem(double time, const vector<String>& a
Service::Ptr service = Service::GetByName(arguments[1]);
if (service->GetState() == StateOK)
throw_exception(invalid_argument("The service '" + arguments[1] + "' is OK."));
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
service->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
service->SetAcknowledgementExpiry(0);
@ -289,6 +292,9 @@ void ExternalCommand::AcknowledgeSvcProblemExpire(double time, const vector<Stri
Service::Ptr service = Service::GetByName(arguments[1]);
if (service->GetState() == StateOK)
throw_exception(invalid_argument("The service '" + arguments[1] + "' is OK."));
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");
service->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
service->SetAcknowledgementExpiry(timestamp);