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

Method ScriptFunc

lib/methods/nullchecktask.cpp:19–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17REGISTER_FUNCTION_NONCONST(Internal, NullCheck, &NullCheckTask::ScriptFunc, "checkable:cr:producer:resolvedMacros:useResolvedMacros");
18
19void NullCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr,
20 const WaitGroup::Ptr& producer, const Dictionary::Ptr& resolvedMacros, bool useResolvedMacros)
21{
22 REQUIRE_NOT_NULL(checkable);
23 REQUIRE_NOT_NULL(cr);
24
25 if (resolvedMacros && !useResolvedMacros)
26 return;
27
28 String output = "Hello from ";
29 output += IcingaApplication::GetInstance()->GetNodeName();
30 ServiceState state = ServiceOK;
31
32 if (Checkable::ExecuteCommandProcessFinishedHandler) {
33 double now = Utility::GetTime();
34 ProcessResult pr;
35 pr.PID = -1;
36 pr.Output = output;
37 pr.ExecutionStart = now;
38 pr.ExecutionEnd = now;
39 pr.ExitStatus = state;
40
41 Checkable::ExecuteCommandProcessFinishedHandler("", pr);
42 } else {
43 cr->SetOutput(output);
44 cr->SetPerformanceData(new Array({
45 new PerfdataValue("time", Convert::ToDouble(Utility::GetTime()))
46 }));
47 cr->SetState(state);
48
49 checkable->ProcessCheckResult(cr, producer);
50 }
51}

Callers

nothing calls this directly

Calls 2

GetNodeNameMethod · 0.80
ProcessCheckResultMethod · 0.45

Tested by

no test coverage detected