check_oracle --tablespace not working with nrpe


#1

Hi Guys,

A very very newbie for nagios and nrpe. Please excuse if I am asking a basic silly question. I am trying to monitor an Oracle Instance which is installed in one of our remote servers. We are using HP-UX machines both for the DB server and for the application servers. Since it is a HP-UX machine, with quite some (great :slight_smile: ) difficulty I had managed to install NAGIOS in the development server. Now triggering the tablespace option of the check_oracle command is working properly in the local(Db server). But monitoring with the nrpe plugin, the results are not as expected, basically it is not returning anything.

Based on some suggestions from some forums/sites, I had put the nrpe user (under which the nrpe is running on the DB server) under the oinstall group(Oracle). Apart from this, I also had the same environmental variables which are exported under the oracle login(like the TNS_ADMIN, ORACLE_HOME and some others), exported under the nrpe login as well. The .profile under the nrpe user looks like below.

PATH=$PATH:$HOME/bin
export ORACLE_HOME=/oracle/ORACLE_DB
export PATH=$ORACLE_HOME/bin:$PATH;
export TNS_ADMIN=$ORACLE_HOME/network/admin

To troubleshoot, I had written a sample Db script to check if the environmental parameters are being accessed. But to my surprise, they are not even getting loaded. A couple of tests also are embedded like the owrking of the "" (system execute), sqlplus execution inside the as shown below. To avoid the ENV variables, I had even hard-coded the oracle home path of the sqlplus and tried as below.

#! /bin/sh
result1=echo "SELECT count(*) FROM all_tables WHERE tablespace_name = 'SYSTEM';" | /oracle/ORACLE_DB/bin/sqlplus oracle/oracle@STRDB
ps=ps -aef | grep oracle ==> This was working, so did not include it in the below return
echo "This is the check_db_sample Script ==> $result1 ||||| $ORACLE_HOME —"
exit 0

Executing this sample script in the nrpe login gives a proper output like

=-------------------------------------------------------------------------------------------------------
$ ./check_db_sample
This is the check_db_sample Script ==>
SQLPlus: Release 11.1.0.7.0 - Production on Mon Feb 14 11:39:32 2011
Copyright ©***** , Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
COUNT(
)

   592

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options ||||| /oracle/ORACLE_DB —
$

But checking from the NAGIOS server with the check_nrpe plugin, I am getting the below output

./check_nrpe -H .*.***.*** -c check_db_sample

This is the check_db_sample Script ==> ||||| —

Notice that, not even ORACLE_HOME is got and so to avoid the ENV variables, I had even hard-coded the oracle home path of the sqlplus and tried as above. Surprisingly, the --db, --login options of the check_oracle plugin are working properly. Only the --tablespace is giving problems. Please do suggest some way to rectify this issue. As you can see, I am close to the solution, but yet not close without your help … :slight_smile:

Regards,
Sandy… :slight_smile:


#2

Hi Sandy,

I’m working on this same issue at present. I’ve reduced the plugin to its most basic form, a simple sql statement, but the issue you had, no output into the variable, will not go away. Did you resolve this?

cheers,
Geofrey.