mirror of https://github.com/Icinga/icinga2.git
Properly deal with exceptions in CheckerComponent::ExecuteCheckHelper.
Refs #4865
This commit is contained in:
parent
c8b3fde2ef
commit
63f22b055b
|
@ -199,7 +199,21 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable)
|
||||||
try {
|
try {
|
||||||
checkable->ExecuteCheck();
|
checkable->ExecuteCheck();
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "checker", "Exception occured while checking '" + checkable->GetName() + "': " + DiagnosticInformation(ex));
|
CheckResult::Ptr cr = make_shared<CheckResult>();
|
||||||
|
cr->SetState(ServiceUnknown);
|
||||||
|
|
||||||
|
String output = "Exception occured while checking '" + checkable->GetName() + "': " + DiagnosticInformation(ex);
|
||||||
|
cr->SetOutput(output);
|
||||||
|
|
||||||
|
double now = Utility::GetTime();
|
||||||
|
cr->SetScheduleStart(now);
|
||||||
|
cr->SetScheduleEnd(now);
|
||||||
|
cr->SetExecutionStart(now);
|
||||||
|
cr->SetExecutionEnd(now);
|
||||||
|
|
||||||
|
checkable->ProcessCheckResult(cr);
|
||||||
|
|
||||||
|
Log(LogCritical, "checker", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue