mirror of https://github.com/Icinga/icinga2.git
Don't allow acknowledgements for services that are OK.
This commit is contained in:
parent
495caa664a
commit
116e420167
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue