fields->Set("_reachable", checkable->IsReachable());
- CheckCommand::Ptr commandObj = checkable->GetCheckCommand();
+ CheckCommand::Ptr checkCommand = checkable->GetCheckCommand();
- if (commandObj)
- fields->Set("_check_command", commandObj->GetName());
+ if (checkCommand)
+ fields->Set("_check_command", checkCommand->GetName());
double ts = Utility::GetTime();
pdv = PerfdataValue::Parse(val);
} catch (const std::exception&) {
Log(LogWarning, "GelfWriter")
- << "Ignoring invalid perfdata value: '" << val << "' for object '"
- << checkable->GetName() << "'.";
+ << "Ignoring invalid perfdata for checkable '"
+ << checkable->GetName() << "' and command '"
+ << checkCommand->GetName() << "' with value: " << val;
continue;
}
}
}
}
- SendLogMessage(ComposeGelfMessage(fields, GetSource(), ts));
+ SendLogMessage(checkable, ComposeGelfMessage(fields, GetSource(), ts));
}
void GelfWriter::NotificationToUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable,
if (commandObj)
fields->Set("_check_command", commandObj->GetName());
- SendLogMessage(ComposeGelfMessage(fields, GetSource(), ts));
+ SendLogMessage(checkable, ComposeGelfMessage(fields, GetSource(), ts));
}
void GelfWriter::StateChangeHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, StateType type)
ts = cr->GetExecutionEnd();
}
- SendLogMessage(ComposeGelfMessage(fields, GetSource(), ts));
+ SendLogMessage(checkable, ComposeGelfMessage(fields, GetSource(), ts));
}
String GelfWriter::ComposeGelfMessage(const Dictionary::Ptr& fields, const String& source, double ts)
return JsonEncode(fields);
}
-void GelfWriter::SendLogMessage(const String& gelfMessage)
+void GelfWriter::SendLogMessage(const Checkable::Ptr& checkable, const String& gelfMessage)
{
std::ostringstream msgbuf;
msgbuf << gelfMessage;
try {
Log(LogDebug, "GelfWriter")
- << "Sending '" << log << "'.";
+ << "Checkable '" << checkable->GetName() << "' sending message '" << log << "'.";
m_Stream->Write(log.CStr(), log.GetLength());
} catch (const std::exception& ex) {