Skip to content

Commit

Permalink
fix parsing unknown perfdata value
Browse files Browse the repository at this point in the history
fixes #700
  • Loading branch information
EmTeedee authored and nilmerg committed Jan 19, 2023
1 parent 0d96994 commit ef16387
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/Icingadb/Util/PerfData.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,17 @@ protected function parse()
$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:
Expand Down

0 comments on commit ef16387

Please sign in to comment.