[prev in list] [next in list] [prev in thread] [next in thread]
List: nagios-users
Subject: [Nagios-users] check_dell_bladechassis 1.0.0 PHP bug fix
From: Mike Hanby <mhanby () uab ! edu>
Date: 2011-12-21 20:50:18
Message-ID: FB27F259B945A440951D7BA3EDBE18A30E37BD () UABEXMB1 ! ad ! uab ! edu
[Download RAW message or body]
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;
}
[Attachment #3 (text/html)]
<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Courier New";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">Howdy,<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">I fixed an issue we had \
with check_dell_bladechassis.php on our OMD 5.x servers (PNP4Nagios Version \
0.6.16)<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">http://folk.uio.no/trondham/software/check_dell_bladechassis.html<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">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:<o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">==================================================<o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">PNP4Nagios Version 0.6.16<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">Please check the \
documentation for information about the following error.<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">Undefined offset: \
1<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">file \
[line]:<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">/opt/omd/sites/mysite/etc/pnp4nagios/templates/check_dell_bladechassis.php \
[44]:<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">==================================================<o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">The following patch \
fixes the issue on our systems.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""><o:p> </o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">--- \
a/check_dell_bladechassis.php 2009-08-04 07:00:15.000000000 \
-0500<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">+++ \
b/check_dell_bladechassis.php 2011-12-21 14:44:25.488132187 \
-0600<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">@@ -41,7 +41,7 \
@@<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> <o:p> \
</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""> $opt[$count] = "--slope-mode \
--vertical-label \"$vlabel\" --title \"$def_title: $title\" \
";<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> <o:p> \
</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">- $def[$count] .= \
"DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">+ $def[$count] = \
"DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"AREA:var$i#$PWRcolor:\"$NAME[$i]\" " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"LINE:var$i#000000: " ;<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">@@ -62,7 +62,7 @@<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> <o:p> \
</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""> $opt[$count] = "-X0 --lower-limit 0 \
--slope-mode --vertical-label \"$vlabel\" --title \"$def_title: \
$title\" ";<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> <o:p> \
</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">- $def[$count] .= \
"DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">+ $def[$count] = \
"DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"AREA:var$i#$AMPcolor:\"$NAME[$i]\" " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"LINE:var$i#000000: " ;<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""><o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">@@ -75,6 +75,7 @@<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
if(preg_match('/^volt_/',$NAME[$i])){<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> if ($visited_volt == 0) {<o:p></o:p></span></p> \
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> \
++$count;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">+ $def[$count] = \
'';<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
$visited_volt = 1;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> }<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">@@ -87,6 +88,7 @@<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> <o:p> \
</o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"DEF:var$i=$rrdfile:$DS[$i]:AVERAGE " ;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> $def[$count] .= \
"LINE:var$i#".$colors[$v++].":\"$NAME[$i]\" " \
;<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier \
New"">+<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
$def[$count] .= "GPRINT:var$i:LAST:\"%3.2lf $UNIT[$i] last \" \
";<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
$def[$count] .= "GPRINT:var$i:MAX:\"%3.2lf $UNIT[$i] max \" \
";<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
$def[$count] .= "GPRINT:var$i:AVERAGE:\"%3.2lf $UNIT[$i] avg \\n\" \
";<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New"">@@ -96,6 +98,7 \
@@<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
if(preg_match('/^amp_/',$NAME[$i])){<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
if ($visited_amp == 0) {<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
++$count;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New"">+ $def[$count] = \
'';<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:"Courier New""> \
$visited_amp = 1;<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier \
New""> }<o:p></o:p></span></p> </div>
</body>
</html>
[Attachment #4 (--===============1761215874232791295==)]
------------------------------------------------------------------------------
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
_______________________________________________
Nagios-users mailing list
Nagios-users@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic