status.dat: Escape new-lines in multi-line plugin output

Fixes #3671
This commit is contained in:
Gunnar Beutner 2013-06-24 11:35:56 +02:00
parent b0ac607caf
commit fe35791b1b
1 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/exception/diagnostic_information.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <fstream>
using namespace icinga;
@ -343,8 +344,12 @@ void CompatComponent::DumpServiceStatusAttrs(std::ostream& fp, const Service::Pt
if (cr) {
output = cr->Get("output");
boost::algorithm::replace_all(output, "\n", "\\n");
schedule_end = cr->Get("schedule_end");
perfdata = cr->Get("performance_data_raw");
boost::algorithm::replace_all(perfdata, "\n", "\\n");
}
int state = service->GetState();