Module: nagvis
Branch: nagvis-1.4
Commit: c651610d4d68ad41dd4f541315da77926f54dc9f
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=c651610d4d68ad41dd4f541315da77926f54dc9f

Author: Lars Michelsen <[email protected]>
Date:   Fri Aug 14 21:44:21 2009 +0200

Fixed php errors when no warn/crit ranges provided in perfdata

---

 nagvis/nagvis/gadgets/gadgets_core.php |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/nagvis/nagvis/gadgets/gadgets_core.php 
b/nagvis/nagvis/gadgets/gadgets_core.php
index e14729c..d15cb1a 100644
--- a/nagvis/nagvis/gadgets/gadgets_core.php
+++ b/nagvis/nagvis/gadgets/gadgets_core.php
@@ -113,17 +113,25 @@ function parsePerfdata($sPerfdata) {
                }
                if(isset($aTmp[4])) {
                        $aSet['warning'] = $aTmp[4];
+                       
+                       // Try to get warn min/max
                        preg_match_all('/([\d\.]+):([\d\.]+)/',$aTmp[4], 
$matches);
-                       $aSet['warning_min'] = $matches[1][0];
-                       $aSet['warning_max'] = $matches[2][0];
+                       if(!isset($matches[0])) {
+                               $aSet['warning_min'] = $matches[1][0];
+                               $aSet['warning_max'] = $matches[2][0];
+                       }
                } else {
                        $aSet['warning'] = null;
                }
                if(isset($aTmp[5])) {
                        $aSet['critical'] = $aTmp[5];
+                       
+                       // Try to get critical min/max
                        preg_match_all('/([\d\.]+):([\d\.]+)/',$aTmp[5], 
$matches);
-                       $aSet['critical_min'] = $matches[1][0];
-                       $aSet['critical_max'] = $matches[2][0];
+                       if(!isset($matches[0])) {
+                               $aSet['critical_min'] = $matches[1][0];
+                               $aSet['critical_max'] = $matches[2][0];
+                       }
                } else {
                        $aSet['critical'] = null;
                }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to