mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 07:04:37 +02:00
Fixes host acknowledgement commands.
This commit is contained in:
parent
fc782473db
commit
dbe1e7cdd5
@ -363,18 +363,18 @@ void ExternalCommand::RemoveSvcAcknowledgement(double time, const vector<String>
|
|||||||
|
|
||||||
void ExternalCommand::AcknowledgeHostProblem(double time, const vector<String>& arguments)
|
void ExternalCommand::AcknowledgeHostProblem(double time, const vector<String>& arguments)
|
||||||
{
|
{
|
||||||
if (arguments.size() < 7)
|
if (arguments.size() < 6)
|
||||||
throw_exception(invalid_argument("Expected 7 arguments."));
|
throw_exception(invalid_argument("Expected 6 arguments."));
|
||||||
|
|
||||||
if (!Host::Exists(arguments[1]))
|
if (!Host::Exists(arguments[0]))
|
||||||
throw_exception(invalid_argument("The host '" + arguments[1] + "' does not exist."));
|
throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
|
||||||
|
|
||||||
int sticky = arguments[2].ToDouble();
|
int sticky = arguments[0].ToDouble();
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(arguments[1]);
|
Host::Ptr host = Host::GetByName(arguments[0]);
|
||||||
|
|
||||||
if (host->IsUp())
|
if (host->IsUp())
|
||||||
throw_exception(invalid_argument("The host '" + arguments[1] + "' is OK."));
|
throw_exception(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'");
|
||||||
host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
||||||
@ -383,19 +383,19 @@ void ExternalCommand::AcknowledgeHostProblem(double time, const vector<String>&
|
|||||||
|
|
||||||
void ExternalCommand::AcknowledgeHostProblemExpire(double time, const vector<String>& arguments)
|
void ExternalCommand::AcknowledgeHostProblemExpire(double time, const vector<String>& arguments)
|
||||||
{
|
{
|
||||||
if (arguments.size() < 8)
|
if (arguments.size() < 7)
|
||||||
throw_exception(invalid_argument("Expected 8 arguments."));
|
throw_exception(invalid_argument("Expected 7 arguments."));
|
||||||
|
|
||||||
if (!Host::Exists(arguments[1]))
|
if (!Host::Exists(arguments[0]))
|
||||||
throw_exception(invalid_argument("The host '" + arguments[1] + "' does not exist."));
|
throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
|
||||||
|
|
||||||
int sticky = arguments[2].ToDouble();
|
int sticky = arguments[1].ToDouble();
|
||||||
double timestamp = arguments[5].ToDouble();
|
double timestamp = arguments[4].ToDouble();
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(arguments[1]);
|
Host::Ptr host = Host::GetByName(arguments[0]);
|
||||||
|
|
||||||
if (host->IsUp())
|
if (host->IsUp())
|
||||||
throw_exception(invalid_argument("The host '" + arguments[1] + "' is OK."));
|
throw_exception(invalid_argument("The host '" + arguments[0] + "' is OK."));
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'");
|
||||||
host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
host->SetAcknowledgement(sticky ? AcknowledgementSticky : AcknowledgementNormal);
|
||||||
@ -404,13 +404,13 @@ void ExternalCommand::AcknowledgeHostProblemExpire(double time, const vector<Str
|
|||||||
|
|
||||||
void ExternalCommand::RemoveHostAcknowledgement(double time, const vector<String>& arguments)
|
void ExternalCommand::RemoveHostAcknowledgement(double time, const vector<String>& arguments)
|
||||||
{
|
{
|
||||||
if (arguments.size() < 2)
|
if (arguments.size() < 1)
|
||||||
throw_exception(invalid_argument("Expected 2 arguments."));
|
throw_exception(invalid_argument("Expected 1 argument."));
|
||||||
|
|
||||||
if (!Host::Exists(arguments[1]))
|
if (!Host::Exists(arguments[0]))
|
||||||
throw_exception(invalid_argument("The host '" + arguments[1] + "' does not exist."));
|
throw_exception(invalid_argument("The host '" + arguments[0] + "' does not exist."));
|
||||||
|
|
||||||
Host::Ptr host = Host::GetByName(arguments[1]);
|
Host::Ptr host = Host::GetByName(arguments[0]);
|
||||||
|
|
||||||
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
|
Logger::Write(LogInformation, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'");
|
||||||
host->SetAcknowledgement(AcknowledgementNone);
|
host->SetAcknowledgement(AcknowledgementNone);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user