Page 1 of 1

Nagios not showing correct status

Posted: Fri Jan 08, 2016 1:08 pm
by shuja_mca
Hi Experts,

I want to check database status using asimple script. which is running well on the commnad prompt.

Below is the scripts.
#!/bin/sh
export TNS_ADMIN=/apps/nagios/instantclient_11_2
echo "exit" | sqlplus -L test1/test1@facetst | grep Connected > /dev/null
if [ $? -eq 0 ]
then
echo "OK"
exit 0
else
echo "NOT OK"
exit 2
fi


but the same script when i have used in nagios , it is always giving me " NOT OK".

Could you please help me urgently please

Re: Nagios not showing correct status

Posted: Fri Jan 08, 2016 1:43 pm
by rkennedy
If you run these commands over the CLI -

Code: Select all

export TNS_ADMIN=/apps/nagios/instantclient_11_2
echo "exit" | sqlplus -L test1/test1@facetst | grep Connected > /dev/null
echo $?
What is the output?