mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
parent
fa61711c21
commit
5cfac1f643
@ -711,7 +711,7 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object, cons
|
|||||||
return ApiActions::CreateResult(404, "Can't find a valid " + command_type + " for '" + resolved_command + "'.");
|
return ApiActions::CreateResult(404, "Can't find a valid " + command_type + " for '" + resolved_command + "'.");
|
||||||
else {
|
else {
|
||||||
EventCommand::ExecuteOverride = cmd;
|
EventCommand::ExecuteOverride = cmd;
|
||||||
Defer resetCheckCommandOverride([]() {
|
Defer resetEventCommandOverride ([]() {
|
||||||
EventCommand::ExecuteOverride = nullptr;
|
EventCommand::ExecuteOverride = nullptr;
|
||||||
});
|
});
|
||||||
cmd->Execute(checkable, execMacros, false);
|
cmd->Execute(checkable, execMacros, false);
|
||||||
@ -761,7 +761,7 @@ Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object, cons
|
|||||||
execParams->Set("notification", notification->GetName());
|
execParams->Set("notification", notification->GetName());
|
||||||
|
|
||||||
NotificationCommand::ExecuteOverride = cmd;
|
NotificationCommand::ExecuteOverride = cmd;
|
||||||
Defer resetCheckCommandOverride([]() {
|
Defer resetNotificationCommandOverride ([]() {
|
||||||
NotificationCommand::ExecuteOverride = nullptr;
|
NotificationCommand::ExecuteOverride = nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void ClusterEvents::EnqueueCheck(const MessageOrigin::Ptr& origin, const Diction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendEventExecuteCommand(const Dictionary::Ptr& params, long exitStatus, const String& output,
|
static void SendEventExecutedCommand(const Dictionary::Ptr& params, long exitStatus, const String& output,
|
||||||
double start, double end, const ApiListener::Ptr& listener, const MessageOrigin::Ptr& origin,
|
double start, double end, const ApiListener::Ptr& listener, const MessageOrigin::Ptr& origin,
|
||||||
const Endpoint::Ptr& sourceEndpoint)
|
const Endpoint::Ptr& sourceEndpoint)
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
<< pr.ExitStatus << ", output: " << pr.Output;
|
<< pr.ExitStatus << ", output: " << pr.Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendEventExecuteCommand(params, pr.ExitStatus, pr.Output, pr.ExecutionStart, pr.ExecutionEnd, listener,
|
SendEventExecutedCommand(params, pr.ExitStatus, pr.Output, pr.ExecutionStart, pr.ExecutionEnd, listener,
|
||||||
origin, sourceEndpoint);
|
origin, sourceEndpoint);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
|
|
||||||
if (params->Contains("source")) {
|
if (params->Contains("source")) {
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SendEventExecuteCommand(params, 126, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, 126, output, now, now, listener, origin, sourceEndpoint);
|
||||||
} else {
|
} else {
|
||||||
Host::Ptr host = new Host();
|
Host::Ptr host = new Host();
|
||||||
Dictionary::Ptr attrs = new Dictionary();
|
Dictionary::Ptr attrs = new Dictionary();
|
||||||
@ -231,7 +231,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
if (params->Contains("source")) {
|
if (params->Contains("source")) {
|
||||||
SendEventExecuteCommand(params, state, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, state, output, now, now, listener, origin, sourceEndpoint);
|
||||||
} else {
|
} else {
|
||||||
CheckResult::Ptr cr = new CheckResult();
|
CheckResult::Ptr cr = new CheckResult();
|
||||||
cr->SetState(state);
|
cr->SetState(state);
|
||||||
@ -249,7 +249,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
|
|
||||||
if (params->Contains("source")) {
|
if (params->Contains("source")) {
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SendEventExecuteCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -261,7 +261,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
|
|
||||||
if (params->Contains("source")) {
|
if (params->Contains("source")) {
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SendEventExecuteCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -286,7 +286,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
|
||||||
if (params->Contains("source")) {
|
if (params->Contains("source")) {
|
||||||
SendEventExecuteCommand(params, state, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, state, output, now, now, listener, origin, sourceEndpoint);
|
||||||
} else {
|
} else {
|
||||||
CheckResult::Ptr cr = new CheckResult();
|
CheckResult::Ptr cr = new CheckResult();
|
||||||
cr->SetState(state);
|
cr->SetState(state);
|
||||||
@ -311,7 +311,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
host->GetName() + "': " + DiagnosticInformation(ex);
|
host->GetName() + "': " + DiagnosticInformation(ex);
|
||||||
|
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SendEventExecuteCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
||||||
} else {
|
} else {
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
|
|||||||
+ "' and user '" + user->GetName() + "' using command '" + command + "': "
|
+ "' and user '" + user->GetName() + "' using command '" + command + "': "
|
||||||
+ DiagnosticInformation(ex, false);
|
+ DiagnosticInformation(ex, false);
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SendEventExecuteCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
SendEventExecutedCommand(params, ServiceUnknown, output, now, now, listener, origin, sourceEndpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user