From 24d95e1178da990512e3dc4984e0bb8b3a669f55 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 10 Aug 2021 16:42:12 +0200 Subject: [PATCH] PluginUtility: Fix PerfData don't get parsed correctly The problem was that some PerfData labels contained several whitespace characters, not just one, and therefore it was parsed incorrectly in `SplitPerfdata()`. I.e. the condition in line 144 checks whether the first and last character is a normal quote, but since the label can contain spaces at the beginning and at the end respectively, this caused the problems. This PR fixes the problem by removing all occurring whitespace from the beginning and end, before starting to parse the actual label. --- lib/icinga/pluginutility.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index 2197d1693..4dc46f754 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -140,6 +140,7 @@ Array::Ptr PluginUtility::SplitPerfdata(const String& perfdata) break; String label = perfdata.SubStr(begin, eqp - begin); + boost::algorithm::trim_left(label); if (label.GetLength() > 2 && label[0] == '\'' && label[label.GetLength() - 1] == '\'') label = label.SubStr(1, label.GetLength() - 2);