diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index b01a0aa1d..98f6284b9 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -97,6 +97,9 @@ Value PluginUtility::ParsePerfdata(const String& perfdata) String key = perfdata.SubStr(begin, eqp - begin); + if (key.GetLength() > 2 && key[0] == '\'' && key[key.GetLength() - 1] == '\'') + key = key.SubStr(1, key.GetLength() - 2); + size_t spq = perfdata.FindFirstOf(' ', eqp); if (spq == String::NPos) diff --git a/test/icinga-perfdata.cpp b/test/icinga-perfdata.cpp index 04812983c..679480634 100644 --- a/test/icinga-perfdata.cpp +++ b/test/icinga-perfdata.cpp @@ -39,6 +39,12 @@ BOOST_AUTO_TEST_CASE(simple) BOOST_CHECK(str == "test=123456"); } +BOOST_AUTO_TEST_CASE(quotes) +{ + Dictionary::Ptr pd = PluginUtility::ParsePerfdata("'hello world'=123456"); + BOOST_CHECK(pd->Get("hello world") == 123456); +} + BOOST_AUTO_TEST_CASE(multiple) { Dictionary::Ptr pd = PluginUtility::ParsePerfdata("testA=123456 testB=123456");