mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Fix output and longOutput
This commit is contained in:
parent
50aa0eb1d3
commit
446796dadb
@ -663,8 +663,20 @@ Dictionary::Ptr RedisWriter::SerializeState(const Checkable::Ptr& checkable)
|
|||||||
CheckResult::Ptr cr = checkable->GetLastCheckResult();
|
CheckResult::Ptr cr = checkable->GetLastCheckResult();
|
||||||
|
|
||||||
if (cr) {
|
if (cr) {
|
||||||
attrs->Set("output", CompatUtility::GetCheckResultOutput(cr));
|
String rawOutput = cr->GetOutput();
|
||||||
attrs->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
|
if (!rawOutput.IsEmpty()) {
|
||||||
|
size_t lineBreak = rawOutput.Find("\n");
|
||||||
|
String output = rawOutput.SubStr(0, lineBreak);
|
||||||
|
if (!output.IsEmpty())
|
||||||
|
attrs->Set("output", rawOutput.SubStr(0, lineBreak));
|
||||||
|
|
||||||
|
if (lineBreak > 0 && lineBreak != String::NPos) {
|
||||||
|
String longOutput = rawOutput.SubStr(lineBreak+1, rawOutput.GetLength());
|
||||||
|
if (!longOutput.IsEmpty())
|
||||||
|
attrs->Set("long_output", longOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cr->GetPerformanceData())
|
if (cr->GetPerformanceData())
|
||||||
attrs->Set("performance_data", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
|
attrs->Set("performance_data", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
|
||||||
if (!cr->GetCommand().IsEmpty())
|
if (!cr->GetCommand().IsEmpty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user