MCPcopy Create free account
hub / github.com/Icinga/icinga2 / ProcessFinishedHandler

Method ProcessFinishedHandler

lib/methods/pluginchecktask.cpp:66–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
67 const WaitGroup::Ptr& producer, const Value& commandLine, const ProcessResult& pr)
68{
69 Checkable::CurrentConcurrentChecks.fetch_sub(1);
70 Checkable::DecreasePendingChecks();
71
72 String output = pr.Output.Trim();
73
74 if (pr.ExitStatus > 3) {
75 Process::Arguments parguments = Process::PrepareCommand(commandLine);
76 Log(LogWarning, "PluginCheckTask")
77 << "Check command for object '" << checkable->GetName() << "' (PID: " << pr.PID
78 << ", arguments: " << Process::PrettyPrintArguments(parguments) << ") terminated with exit code "
79 << pr.ExitStatus << ", output: " << pr.Output;
80
81 std::stringstream crOutput;
82
83 crOutput << "<Terminated with exit code " << pr.ExitStatus
84 << " (0x" << std::noshowbase << std::hex << std::uppercase << pr.ExitStatus << ").>";
85
86 output += crOutput.str();
87 }
88
89 std::pair<String, String> co = PluginUtility::ParseCheckOutput(output);
90 cr->SetCommand(commandLine);
91 cr->SetOutput(co.first);
92 cr->SetPerformanceData(PluginUtility::SplitPerfdata(co.second));
93 cr->SetState(PluginUtility::ExitStatusToState(pr.ExitStatus));
94 cr->SetExitStatus(pr.ExitStatus);
95 cr->SetExecutionStart(pr.ExecutionStart);
96 cr->SetExecutionEnd(pr.ExecutionEnd);
97
98 checkable->ProcessCheckResult(cr, producer);
99}

Callers

nothing calls this directly

Calls 4

LogClass · 0.85
TrimMethod · 0.80
GetNameMethod · 0.45
ProcessCheckResultMethod · 0.45

Tested by

no test coverage detected