check_dell_bladechassis 1.0.0 PHP bug fix

Mike Hanby mhanby at uab.edu
Wed Dec 21 21:50:18 CET 2011


Howdy,

I fixed an issue we had with check_dell_bladechassis.php on our OMD 5.x servers (PNP4Nagios Version 0.6.16)
http://folk.uio.no/trondham/software/check_dell_bladechassis.html

The problem had to do with attempting to concat a variable (array element) that didn't yet exist, resulting in the following error when viewing the graphs in PNP4Nagios:
==================================================
PNP4Nagios Version 0.6.16
Please check the documentation for information about the following error.

Undefined offset: 1
file [line]:

/opt/omd/sites/mysite/etc/pnp4nagios/templates/check_dell_bladechassis.php [44]:
==================================================

The following patch fixes the issue on our systems.

--- a/check_dell_bladechassis.php   2009-08-04 07:00:15.000000000 -0500
+++ b/check_dell_bladechassis.php   2011-12-21 14:44:25.488132187 -0600
@@ -41,7 +41,7 @@

      $opt[$count] = "--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";

-        $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
+        $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
         $def[$count] .= "AREA:var$i#$PWRcolor:\"$NAME[$i]\" " ;
         $def[$count] .= "LINE:var$i#000000: " ;
@@ -62,7 +62,7 @@

      $opt[$count] = "-X0 --lower-limit 0 --slope-mode --vertical-label \"$vlabel\" --title \"$def_title: $title\" ";

-        $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
+        $def[$count] = "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
         $def[$count] .= "AREA:var$i#$AMPcolor:\"$NAME[$i]\" " ;
         $def[$count] .= "LINE:var$i#000000: " ;
@@ -75,6 +75,7 @@
     if(preg_match('/^volt_/',$NAME[$i])){
     if ($visited_volt == 0) {
         ++$count;
+         $def[$count] = '';
         $visited_volt = 1;
     }

@@ -87,6 +88,7 @@

      $def[$count] .= "DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;
     $def[$count] .= "LINE:var$i#".$colors[$v++].":\"$NAME[$i]\" " ;
+
     $def[$count] .= "GPRINT:var$i:LAST:\"%3.2lf $UNIT[$i] last \" ";
     $def[$count] .= "GPRINT:var$i:MAX:\"%3.2lf $UNIT[$i] max \" ";
     $def[$count] .= "GPRINT:var$i:AVERAGE:\"%3.2lf $UNIT[$i] avg \\n\" ";
@@ -96,6 +98,7 @@
     if(preg_match('/^amp_/',$NAME[$i])){
     if ($visited_amp == 0) {
         ++$count;
+         $def[$count] = '';
         $visited_amp = 1;
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20111221/a28e6380/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list