<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>FW: Nagios / Perl oracle monitoring script</TITLE>
</HEAD>
<BODY>
<P><FONT COLOR="#000000" SIZE=2 FACE="Arial">All,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Hi, My name is Ken Munson and I work for Dallas Semiconductor in Dallas, TX. I </FONT><FONT COLOR="#000000" SIZE=2 FACE="Arial">found a</FONT><FONT SIZE=2 FACE="Arial"> perl script for checking the state of Oracle table spaces in a beta version tarball of some contributed plugins for Nagios. It looks very good. I had a considerable challenge to get the DBD:Oracle and DBI modules working with perl on my Redhat 7.3 system. Now that I have them working I can't quite seem to get the script to run correctly. I am running it against an Oracle 9i database that's on the same machine as Nagios - a test database. The script doesn't return any output to the command line. I have inserted print statements throughout the script (my perl skills are sadly lacking) and have found that it goes through the whole script EXCEPT for the block of code that follows:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">while (($tbname, $total, $used, $pct_used) = $sth->fetchrow)</FONT>
<BR><FONT SIZE=2 FACE="Arial">{</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $pct_used=int($pct_used);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> print STDOUT "size: " . $total . " MB Used:" . int($used) . " MB (" . int($pct_used) . "%)\n";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> #print "table space $answer\n";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> if ($pct_used > $alertpct) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> if ($pct_used > $critpct) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $exit_code = 2</FONT>
<BR><FONT SIZE=2 FACE="Arial"> } else {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $exit_code = 1;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> }</FONT>
<BR><FONT SIZE=2 FACE="Arial"> } else {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $exit_code = 0;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> }</FONT>
<BR><FONT SIZE=2 FACE="Arial">}</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">I assume it is not executing this code because the condition of the while statement is false. My problem is I'm not good enough at troubleshooting perl to tell why this "while" statement is false. Especially in light of the interwoven Oracle stuff that's in the script. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">I also moved the following two lines above the "while" command:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">$pct_used=int($pct_used);</FONT>
<BR><FONT SIZE=2 FACE="Arial">print STDOUT "size: " . $total . " MB Used:" . int($used) . " MB (" . int($pct_used) . "%)\n";</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">and the screen output looks like this:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">size MB Used: 0 MB</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Any insight you have would be VERY GREATLY appreciated. I don't want to eat up a bunch of your time but I thought if you knew something I could try that comes to you quickly....you might enlighten me with it.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thnaks very much for you time!</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Ken Munson</FONT>
<BR><FONT SIZE=2 FACE="Arial">972.371.4779</FONT>
<BR><FONT SIZE=2 FACE="Arial">ken.munson@dalsemi.com</FONT>
</P>
<BR>
</BODY>
</HTML>