[icinga-checkins] icinga.org: icingaweb2/master: Performance data: handle negative values

git at icinga.org git at icinga.org
Wed Aug 31 15:48:31 CEST 2016


Module: icingaweb2
Branch: master
Commit: 13085776d89c58369b029dfcf1affe8eebbd1caa
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=13085776d89c58369b029dfcf1affe8eebbd1caa

Author: Alexander A. Klimov <alexander.klimov at netways.de>
Date:   Wed Aug 31 15:46:22 2016 +0200

Performance data: handle negative values

fixes #11915

---

 modules/monitoring/library/Monitoring/Plugin/Perfdata.php |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php
index 0c9f09d..9008a27 100644
--- a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php
+++ b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php
@@ -282,7 +282,7 @@ class Perfdata
         $parts = explode(';', $this->perfdataValue);
 
         $matches = array();
-        if (preg_match('@^(\d+(\.\d+)?)([a-zA-Z%]{1,2})$@', $parts[0], $matches)) {
+        if (preg_match('@^(-?\d+(\.\d+)?)([a-zA-Z%]{1,2})$@', $parts[0], $matches)) {
             $this->unit = strtolower($matches[3]);
             $this->value = self::convert($matches[1], $this->unit);
         } else {



More information about the icinga-checkins mailing list