<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<font face="Courier New, Courier, monospace">Actually no. In the
snmp.sh plugin that comes with APAN a system call to check_snmp is
used. No warning or critical value are given to the check_snmp plugin
therefore it always returns a code of 1 (or warning condition). The
APAN plugin is supposed to silently ignore the warning and go about
it's business. However the code as distributed seems to detect the
warning and error out.</font><br>
<br>
<font face="Courier New, Courier, monospace">Original code from snmp.sh
APAN plugin.</font><br>
<br>
<font face="Courier New, Courier, monospace">
VALUE=`$PLUGINSDIR/check_snmp -H $HOST -C $COMM -m none -o $OID`</font><br>
<font face="Courier New, Courier, monospace"> STATUS=$?</font><br>
<font face="Courier New, Courier, monospace">
COUNTER=`echo $VALUE|awk '{print $NF}'`</font><br>
<font face="Courier New, Courier, monospace"> if [
$STATUS -gt 0 ]; then</font><br>
<font face="Courier New, Courier, monospace">
RETVAL=2</font><br>
<font face="Courier New, Courier, monospace">
RETSTR=`echo "$VALUE"|head -1`</font><br>
<font face="Courier New, Courier, monospace">
ERR=1</font><br>
<font face="Courier New, Courier, monospace">
break</font><br>
<font face="Courier New, Courier, monospace"> fi</font><br>
<font face="Courier New, Courier, monospace">
TEMPL="$TEMPL:$DSNAME"</font><br>
<br>
<br>
<font face="Courier New, Courier, monospace">If I modify the script to
look like the following and it will work flawlessly.</font><br>
<br>
<font face="Courier New, Courier, monospace">
VALUE=`$PLUGINSDIR/check_snmp -H $HOST -C $COMM -m none -o $OID`</font><br>
<font face="Courier New, Courier, monospace"># force a good return
value</font><br>
<font face="Courier New, Courier, monospace"># STATUS=$?</font><br>
<font face="Courier New, Courier, monospace"> STATUS=0</font><br>
<font face="Courier New, Courier, monospace">
COUNTER=`echo $VALUE|awk '{print $NF}'`</font><br>
<font face="Courier New, Courier, monospace"> if [
$STATUS -gt 0 ]; then</font><br>
<font face="Courier New, Courier, monospace">
RETVAL=2</font><br>
<font face="Courier New, Courier, monospace">
RETSTR=`echo "$VALUE"|head -1`</font><br>
<font face="Courier New, Courier, monospace">
ERR=1</font><br>
<font face="Courier New, Courier, monospace">
break</font><br>
<font face="Courier New, Courier, monospace"> fi</font><br>
<font face="Courier New, Courier, monospace">
TEMPL="$TEMPL:$DSNAME"</font><br>
<br>
<font face="Courier New, Courier, monospace">How is this script working
for other people using Nagios/APAN. I do not understand why I had to
modify this?</font><br>
<br>
<br>
<br>
<font face="Courier New, Courier, monospace">-- <br>
<br>
Timothy Stoddard</font><br>
<br>
Lawrence, Lynne wrote:<br>
<blockquote type="cite"
cite="mid13828F680182D511893300508BD6831706E58304@oscex2.osc.uscg.mil">
<meta http-equiv="Content-Type" content="text/html; ">
<title></title>
<meta content="MSHTML 6.00.2800.1458" name="GENERATOR">
<div><span class="406020918-26082004"><font color="#0000ff" size="2">I
suspect that the change you made did not fix your problem. The '{print
$NF}' is in single quotes, as such your variable would not be
replaced. In awk, $NF is the number of fields in the line, so the
print statement will print the last field on the line, fields being
separated by whitespace.</font></span></div>
<div> </div>
<div><span class="406020918-26082004"><font color="#0000ff" size="2">Hope
this helps,</font></span></div>
<div> </div>
<div><span class="406020918-26082004"><font color="#0000ff" size="2">Lynne
Lawrence</font></span></div>
<blockquote dir="ltr"
style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div class="OutlookMessageHeader" dir="ltr" align="left"><font
face="Tahoma" size="2">-----Original Message-----<br>
<b>From:</b> <a class="moz-txt-link-abbreviated" href="mailto:nagios-users-admin@lists.sourceforge.net">nagios-users-admin@lists.sourceforge.net</a>
[<a class="moz-txt-link-freetext" href="mailto:nagios-users-admin@lists.sourceforge.net">mailto:nagios-users-admin@lists.sourceforge.net</a>]<b>On Behalf Of </b>Tim
Stoddard<br>
<b>Sent:</b> Thursday, August 26, 2004 10:20 AM<br>
<b>To:</b> HUDRY Olivier<br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a><br>
<b>Subject:</b> Re: [Nagios-users] apan snmp plugin problem<br>
<br>
</font></div>
<tt>I got the same problem when I installed APAN on Nagios. I
ended up hacking the snmp.sh that come with APAN. One of the shell
variables was not getting set correctly, so I ended up creating a work
around. The $NF variable in the following line needs to 4, however I
cannot find where it gets set. This $VALUE is the output line that
APAN has to parse. The fourth value is the actual snmp value APAN
is looking for. </tt><br>
<br>
<br>
<tt> COUNTER=`echo $VALUE|awk '{print $NF}'`</tt><br>
<br>
<tt>I added the following and APAN began to work like champ. </tt><br>
<br>
<tt>#It would seem the $NF variable is not getting set</tt><br>
<tt>NF=4</tt><br>
<tt>#echo "$NF"</tt><br>
<tt> STATUS=$?</tt><br>
<tt> COUNTER=`echo $VALUE|awk '{print $NF}'`</tt><br>
<br>
<tt>My shell scripting is not great. I am sure someone else could
pretty this up. Hope this helps. </tt><br>
<pre class="moz-signature" cols="72">--
Timothy Stoddard
</pre>
<br>
HUDRY Olivier wrote:<br>
<blockquote
cite="mid4A7F0CFD7524F2479E23018A4E840B363B069D@gipexch.gip.gip-cps.fr"
type="cite">
<meta content="MSHTML 6.00.2800.1458" name="GENERATOR">
<div><font face="Arial" size="2">
<div><font face="Arial" size="2"><span class="180191109-26082004">hi,</span></font></div>
<div> </div>
<div><font face="Arial" size="2"><span class="180191109-26082004">I'm
trying to monitor some disk usage with apan-sql</span></font></div>
<div><font face="Arial" size="2"><span class="180191109-26082004">i've
created:</span></font></div>
<div><font face="Arial" size="2"><span class="180191109-26082004">-
service in nagios</span></font></div>
<div><font face="Arial" size="2"><span class="180191109-26082004">-
serviceext</span></font></div>
<div><font face="Arial" size="2"><span class="180191109-26082004">-
database record with apanconf</span></font></div>
<div> </div>
<div><span class="180191109-26082004"><font face="Arial" size="2">and
i'can't get info from this plug-in.</font></span></div>
<div> </div>
<div><span class="180191109-26082004"><font face="Arial" size="2">the
message in nagios is:</font></span></div>
<div> </div>
<div><span class="180191109-26082004">(Return code of 127 is out
of bounds - plugin may be missing) </span></div>
<div> </div>
<div><span class="180191109-26082004"><font face="Arial" size="2">thanks
for your help</font></span></div>
</font></div>
<div> </div>
<div dir="ltr" align="left"><font face="Arial" size="2">-----------------------------------------------------</font></div>
<div dir="ltr" align="left"><font face="Arial" size="2">
Olivier HUDRY</font></div>
<div dir="ltr" align="left"><font face="Arial" size="2">Technicien
d'exploitation - Pôle E&A</font></div>
<div dir="ltr" align="left"><font face="Arial" size="2"> <a
href="mailto:o.hudry@gip-cps.fr">o.hudry@gip-cps.fr</a></font></div>
<div dir="ltr" align="left"><font face="Arial" size="2">-----------------------------------------------------</font></div>
<div> </div>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>