From ef16387ca0abe7ff10daf4d9cbdc984c8e1b2938 Mon Sep 17 00:00:00 2001 From: Tobias Tiederle Date: Tue, 17 Jan 2023 11:23:51 +0000 Subject: [PATCH] fix parsing unknown perfdata value fixes #700 --- library/Icingadb/Util/PerfData.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/Icingadb/Util/PerfData.php b/library/Icingadb/Util/PerfData.php index 2d83c540..eccafc54 100644 --- a/library/Icingadb/Util/PerfData.php +++ b/library/Icingadb/Util/PerfData.php @@ -426,13 +426,17 @@ class PerfData $parts = explode(';', $this->perfdataValue); $matches = array(); - if (preg_match('@^(-?(?:\d+)?(?:\.\d+)?)([a-zA-Z%°]{1,3})$@u', $parts[0], $matches)) { + if (preg_match('@^(U|-?(?:\d+)?(?:\.\d+)?)([a-zA-TV-Z%°]{1,3})$@u', $parts[0], $matches)) { $this->unit = $matches[2]; $this->value = $matches[1]; } else { $this->value = $parts[0]; } + if (! is_numeric($this->value)) { + $this->value = null; + } + switch (count($parts)) { /* @noinspection PhpMissingBreakStatementInspection */ case 5: