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

Method ExecuteCheckHelper

lib/checker/checkercomponent.cpp:241–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
242{
243 try {
244 checkable->ExecuteCheck(m_WaitGroup);
245 } catch (const std::exception& ex) {
246 CheckResult::Ptr cr = new CheckResult();
247 cr->SetState(ServiceUnknown);
248
249 String output = "Exception occurred while checking '" + checkable->GetName() + "': " + DiagnosticInformation(ex);
250 cr->SetOutput(output);
251
252 double now = Utility::GetTime();
253 cr->SetScheduleStart(now);
254 cr->SetScheduleEnd(now);
255 cr->SetExecutionStart(now);
256 cr->SetExecutionEnd(now);
257
258 checkable->ProcessCheckResult(cr, m_WaitGroup);
259
260 Log(LogCritical, "checker", output);
261 }
262
263 Checkable::DecreasePendingChecks();
264
265 {
266 std::unique_lock<std::mutex> lock(m_Mutex);
267
268 /* remove the object from the list of pending objects; if it's not in the
269 * list this was a manual (i.e. forced) check and we must not re-add the
270 * object to the list because it's already there. */
271 auto it = m_PendingCheckables.find(checkable);
272
273 if (it != m_PendingCheckables.end()) {
274 m_PendingCheckables.erase(it);
275
276 if (checkable->IsActive())
277 m_IdleCheckables.insert(GetCheckableScheduleInfo(checkable));
278
279 m_CV.notify_all();
280 }
281 }
282
283 Log(LogDebug, "CheckerComponent")
284 << "Check finished for object '" << checkable->GetName() << "'";
285}
286
287void CheckerComponent::ResultTimerHandler()
288{

Callers

nothing calls this directly

Calls 9

LogClass · 0.85
ExecuteCheckMethod · 0.80
findMethod · 0.80
IsActiveMethod · 0.80
GetNameMethod · 0.45
ProcessCheckResultMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected