mirror of https://github.com/Icinga/icinga2.git
Fix perfdata parser not recognize scientific notation
The scientific notation is basically allowed in our performance data parser. In an edge case where scientific notation is delivered with an upercas E letter our parser does not recognize it and drops it as false performance data. The wrong interpretation as false performance data affects all parts of the performance data, the value itself, the warning value, the critical value, the minimum value and the maximum value.
This commit is contained in:
parent
2d1980c10d
commit
b9c6abc38c
|
@ -45,7 +45,7 @@ PerfdataValue::Ptr PerfdataValue::Parse(const String& perfdata)
|
|||
|
||||
String valueStr = perfdata.SubStr(eqp + 1, spq - eqp - 1);
|
||||
|
||||
size_t pos = valueStr.FindFirstNotOf("+-0123456789.e");
|
||||
size_t pos = valueStr.FindFirstNotOf("+-0123456789.eE");
|
||||
|
||||
double value = Convert::ToDouble(valueStr.SubStr(0, pos));
|
||||
|
||||
|
@ -160,7 +160,7 @@ String PerfdataValue::Format() const
|
|||
|
||||
Value PerfdataValue::ParseWarnCritMinMaxToken(const std::vector<String>& tokens, std::vector<String>::size_type index, const String& description)
|
||||
{
|
||||
if (tokens.size() > index && tokens[index] != "U" && tokens[index] != "" && tokens[index].FindFirstNotOf("+-0123456789.e") == String::NPos)
|
||||
if (tokens.size() > index && tokens[index] != "U" && tokens[index] != "" && tokens[index].FindFirstNotOf("+-0123456789.eE") == String::NPos)
|
||||
return Convert::ToDouble(tokens[index]);
|
||||
else {
|
||||
if (tokens.size() > index && tokens[index] != "")
|
||||
|
|
Loading…
Reference in New Issue