<!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 6.5.7652.24">
<TITLE>Problems with correct execution Nagios Plugin scheduled</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>Hello,<BR>
I have one problem very particular on a Nagios check custom. It try to execute one query to Oracle Server.<BR>
When I run my plugin from Linux shell as nagios user, the check returns correct output. But, when Nagios runs the same plugin with the same parameters, the check returns incorrect output.<BR>
The permissions are OK, otherwise Nagios check doesn't returned correct result from shell as nagios user.<BR>
<BR>
What's wrong? Any ideas?<BR>
<BR>
Thanks<BR>
Giovanni<BR>
<BR>
<BR>
This is a part of my plugin.<BR>
<BR>
---------------------------------------------------------------------<BR>
<BR>
STATE_ERROR=-1<BR>
STATE_OK=0<BR>
STATE_CRITICAL=2<BR>
STATE_UNKNOWN=3<BR>
<BR>
ECHO=/bin/echo<BR>
FILE=/instantclient_11_1/query<BR>
QUERY="select 'SQL Query Test is Ok' from dual;"<BR>
SQLPLUS=/instantclient_11_1/sqlplus<BR>
<BR>
esegui_plugin()<BR>
{<BR>
<BR>
        blank=" "<BR>
<BR>
        HOSTNAME=${2:-blank}<BR>
<BR>
touch $FILE<BR>
<BR>
<BR>
$ECHO $QUERY | $SQLPLUS -s nagios/nagios@//${HOSTNAME}/orcl > $FILE<BR>
<BR>
<BR>
<BR>
<BR>
grep -q Ok $FILE<BR>
if [ $? -eq 0 ] ; then<BR>
        exitstatus=${STATE_OK}<BR>
        echo "SQL Query Test is Ok"<BR>
        rm -f $FILE<BR>
        exit $exitstatus<BR>
else<BR>
        exitstatus=${STATE_CRITICAL}<BR>
        echo "CRITICAL - ORACLE SERVER NOT RESPONDING"<BR>
        rm -f $FILE<BR>
        exit $exitstatus<BR>
fi<BR>
<BR>
}<BR>
<BR>
---------------------------------------------------------------------<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>