Problems with correct execution Nagios Plugin scheduled

Giovanni Ciampi Giovanni.Ciampi at enterpriseda.com
Wed Jun 25 10:32:54 CEST 2008


Hello,
I have one problem very particular on a Nagios check custom. It try to execute one query to Oracle Server. 
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.
The permissions are OK, otherwise Nagios check doesn't returned correct result from shell as nagios user.

What's wrong? Any ideas?

Thanks
Giovanni


This is a part of my plugin.

---------------------------------------------------------------------

STATE_ERROR=-1
STATE_OK=0
STATE_CRITICAL=2
STATE_UNKNOWN=3

ECHO=/bin/echo
FILE=/instantclient_11_1/query
QUERY="select 'SQL Query Test is Ok' from dual;"
SQLPLUS=/instantclient_11_1/sqlplus

esegui_plugin()
{

        blank=" "

        HOSTNAME=${2:-blank}

touch $FILE


$ECHO $QUERY | $SQLPLUS -s nagios/nagios@//${HOSTNAME}/orcl > $FILE




grep -q Ok $FILE
if [ $? -eq 0 ] ; then
        exitstatus=${STATE_OK}
        echo "SQL Query Test is Ok"
        rm -f $FILE
        exit $exitstatus
else
        exitstatus=${STATE_CRITICAL}
        echo "CRITICAL - ORACLE SERVER NOT RESPONDING"
        rm -f $FILE
        exit $exitstatus
fi

}

---------------------------------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080625/7c56a44f/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
-------------- 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