check_oracle plug in help


#1

Hi All,

This is my first posting. I’ve installed and configured nagios without any problem. I do even monitoring remote hosts fine with nrpe plug-in. It checks well and gives the accurate output. I have problems with check_oracle plug in.

ex, localbo:evil:testln:evil: where nagios server is running
remotebo:evil:oradb) where oracle server running with nrpe add ons installed.

I am doing this on localbox,

[nagios@testlnx libexec]$ /home/nagios/nagios/libexec/check_nrpe -H 10.192.2.239 -c check_tns
No TNS Listener on playdb1

in remote machine, nrpe.cfg contains

command[check_tns]=/usr/local/nagios/libexec/check_oracle --tns playdb1

this command works on remote machine well,

[nagios@oradb libexec]$ /usr/local/nagios/libexec/check_oracle --tns playdb1
OK - reply time 0 msec from playdb1

nagios user on remote machine well set ORACLE_HOME and also it can run sqlplus and tnsping commands fine.

can you please tell us where could be the problem?

thanks in advance


#2

Does anybody have a solutions for this problem?

Please he lp me?


#3

Try to debug: add a few debug-lines in the check_oracle script, something like:

else
echo “No TNS Listener on $2”

debug

echo $tnschk2 >> /tmp/debug.txt
echo $ORACLE_HOME >> /tmp/debug.txt
exit $STATE_CRITICAL
fi

That way you’ll find out what the ping is returning, and if the environment-variables are correct.


#4

Here are the tests,

I added the following codes to the check_oracle script on the remote db server as nagios user,

else
echo “No TNS Listener on $2”
# debug
echo $tnschk2 >> /tmp/debug.txt
echo $ORACLE_HOME >> /tmp/debug.txt

–db)
pmonchk=ps -ef | grep -v grep | grep -c "ora_pmon_${2}$"
if ${pmonchk} -ge 1 ] ; then
echo “${2} OK - ${pmonchk} PMON process(es) running”
# debug
echo $pmonchk >> /tmp/debug_pmon.txt
echo $ORACLE_HOME >> /tmp/debug_pmon.txt

then tired from nagios server

[nagios@lnxtestsrv1 objects]$ /home/nagios/nagios/libexec/check_nrpe -H 10.192.2.239 -c check_sid
playdb1 OK - 1 PMON process(es) running
[nagios@lnxtestsrv1 objects]$ /home/nagios/nagios/libexec/check_nrpe -H 10.192.2.239 -c check_tns
No TNS Listener on playdb1

to to /tmp on remote db,

cat debug_pmon.txt
1
/oraeng/apps/oracle/product/10.2.0

cat debug.txt
0
/oraeng/apps/oracle/product/10.2.0

The ORACLE_HOME is same for both senarios, one works fine and another doesn’t .

Please suggest anything, thanks


#5

One more thing, I have another oracle database to monitor through nagios. I made the same changes to the check_oracle on second db server. Pmon process running perfectly but not the tnsping as result it has the same error"no TNS listerner" but when I go to /tmp folder I only see one file which is /tmp/debug_pmon.txt but there is no file called /tmp/debug.txt. It looks to me that nrpe deamon was unable to run the --tns) section of check_oracle script.

[root@ora124 tmp]# cat debug_pmon.txt
1
/opt/oracle/10gR2/db_1

Please suggest, thanks


#6

please ignore my previous email, the file got created under /tmp.
cat debug.txt
0
/opt/oracle/10gR2/db_1


#7

The db and tns checks are very different: the db-check simply checks if there is an Oracle pmon-process running on the server, the tns-check uses an Oracle utility named tnsping…

We need to know what happens during the tnsping executed from the monitoring host. Please make a small change in the debugging, instead of looking at $tnschk2, let’s look at $tnschk :


else
echo “No TNS Listener on $2”

debug

echo $tnschk >> /tmp/debug.txt
echo $ORACLE_HOME >> /tmp/debug.txt
exit $STATE_CRITICAL
fi


#8

Here is the output,

[root@ora1234 tmp]# cat debug.txt

/oraeng/apps/oracle/product/10.2.0

Looks it won’t display the output instead there is some blank space come up as you can see in the file first portion is blank and then the path of ORACLE_HOME.

I am trying out with different senarios and let you know the results. Do you have any idea why it just shows a blank output?

thanks


#9

I was able to fix the problem. The solution is, on the remote db box go to the /etc/xinetd.d/nrpe
added,
user = nagios
groups = yes – added this line

and restarted xinetd deamon. that did it.

Thank you :slight_smile: