mirror of https://github.com/Icinga/icinga2.git
parent
4b52528c48
commit
2dacc047ec
|
@ -97,6 +97,9 @@ Value PluginUtility::ParsePerfdata(const String& perfdata)
|
||||||
|
|
||||||
String key = perfdata.SubStr(begin, eqp - begin);
|
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);
|
size_t spq = perfdata.FindFirstOf(' ', eqp);
|
||||||
|
|
||||||
if (spq == String::NPos)
|
if (spq == String::NPos)
|
||||||
|
|
|
@ -39,6 +39,12 @@ BOOST_AUTO_TEST_CASE(simple)
|
||||||
BOOST_CHECK(str == "test=123456");
|
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)
|
BOOST_AUTO_TEST_CASE(multiple)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr pd = PluginUtility::ParsePerfdata("testA=123456 testB=123456");
|
Dictionary::Ptr pd = PluginUtility::ParsePerfdata("testA=123456 testB=123456");
|
||||||
|
|
Loading…
Reference in New Issue