Closed icinga-migration closed 6 years ago
Updated by gbeutner on 2016-11-15 10:10:57 +00:00
CompatUtility::GetCheckResultOutput seems to be the culprit here. According to Michael this was added to improve compatibility with how Icinga 1.x handles this. The rationale being that shell scripts would have to replace semi-colons with colon when using macro values in external commands. We should probably discuss whether to change this behavior.
String CompatUtility::GetCheckResultOutput(const CheckResult::Ptr& cr)
{
if (!cr)
return Empty;
String output;
String raw_output = cr->GetOutput();
/*
* replace semi-colons with colons in output
* semi-colon is used as delimiter in various interfaces
*/
boost::algorithm::replace_all(raw_output, ";", ":");
size_t line_end = raw_output.Find("\n");
return raw_output.SubStr(0, line_end);
}
Guess we can only change that for DB IDO, all other interfaces might break (esp. Livestatus and statusdata)
michi@mbmif ~/coding/icinga/icinga2 (master=) $ grep -r GetCheckResultOutput lib/
lib//compat/compatlogger.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//compat/compatlogger.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//compat/compatlogger.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//compat/compatlogger.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//compat/statusdatawriter.cpp: "\t" "plugin_output=" << CompatUtility::GetCheckResultOutput(cr) << "\n"
lib//db_ido/dbevents.cpp: fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
lib//db_ido/dbevents.cpp: fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
lib//db_ido/dbevents.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//db_ido/dbevents.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//db_ido/dbevents.cpp: fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
lib//db_ido/hostdbobject.cpp: fields->Set("output", CompatUtility::GetCheckResultOutput(cr));
lib//db_ido/servicedbobject.cpp: fields->Set("output", CompatUtility::GetCheckResultOutput(cr));
lib//icinga/compatutility.cpp:String CompatUtility::GetCheckResultOutput(const CheckResult::Ptr& cr)
lib//icinga/compatutility.hpp: static String GetCheckResultOutput(const CheckResult::Ptr& cr);
lib//livestatus/hoststable.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//livestatus/hoststable.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//livestatus/servicestable.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//perfdata/gelfwriter.cpp: fields->Set("short_message", CompatUtility::GetCheckResultOutput(cr));
lib//perfdata/gelfwriter.cpp: output = CompatUtility::GetCheckResultOutput(cr);
lib//perfdata/gelfwriter.cpp: fields->Set("short_message", CompatUtility::GetCheckResultOutput(cr));
Consider it for a new backend, and partially adopt features like GelfWriter.
The only real problem lies with using the output and passing it into the command pipe again. Tools should already have a safety mechanism for user inputs with colons either. I'll fix that for 2.9.
This issue has been migrated from Redmine: https://dev.icinga.com/issues/13195
Created by elippmann on 2016-11-15 09:30:47 +00:00
Assignee: (none) Status: New Target Version: (none) Last Update: 2016-11-15 10:10:57 +00:00 (in Redmine)
For example one can't use HTML entities in the plugin output.