check_oracle_health help run

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
clinton92
Posts: 10
Joined: Thu Sep 28, 2017 1:29 pm

Re: check_oracle_health help run

Post by clinton92 »

dwasswa wrote:Hi @ clinton92,

I tested the plugin and got the same error.

Therefore,its a problem with the plugin.
I see, so maybe there's no way to throw oracle queries to nagios?

Have you tried that anyway? any suggestions?
dwasswa

Re: check_oracle_health help run

Post by dwasswa »

Actually,there is a way.

If monitor Oracle databases to ensure your system is functioning properly.

Follow these steps:


1.Acquire The Required RPM Files And Install Script
Open a terminal and log into your Nagios server as the root user. Download the install script to the /tmp folder of your Nagios
server:

Code: Select all

cd /tmp
wget http://assets.nagios.com/downloads/general/scripts/oracleinstall.sh
First thing we will need to determine is what architecture is running on your Nagios Linux server. If you already know it, you can skip
this step, but be sure to double-check as you will need to know it later in the document.

At your Linux command prompt type the following command:

Code: Select all

uname -i
This will return the architecture of your system. It will either be:

Code: Select all

i?86
Or

Code: Select all

x86_64
The ? in

Code: Select all

i?86
represent any numbers returned. However for our purposes it boils down to one thing, your system is 32 bit. If its equal
to the bottom then your architecture is 64 bit. With this information we can now download the proper RPMs.

Due to legal reasons, Nagios cannot provide direct download links to these RPMs so you will have to go to Oracle's website and download them. Navigate to http://www.oracle.com/
and create an account.
oracle _plugins.PNG
Now based on the results from the previous

Code: Select all

uname -i
command, select the proper install for your particular Nagios installation, either 32 bit or 64 bit.
Cap.PNG
Cap.PNG (4.2 KiB) Viewed 3457 times
NEXT STEP:
Capt1.PNG


Run The Install Script
Once you've moved the script and all the .rpm files to the same directory, its time to execute the script:

Code: Select all

chmod +x oracleinstall.sh
./oracleinstall.sh
This script will take care of most of the dirty work. It will install some dependencies using yum, then grab the check_oracle_health tarball from the internet, configure and install it, then install the Perl dependencies through CPAN. At the very end, will dump out some variables that you will need to apply to your particular case. In my case they look like this:

Code: Select all

ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
Copy these variable somewhere as you will need them later in the document.

Configure Oracle Plugin Commands
We need to make a few modifications to commands used by the Oracle wizards. The Oracle check plugins requires access to outside libraries, and Nagios does not spawn processes with access to outside environment variables, and these environment variables are particular to your computer. The install script should have created two environment variables for you (
ORACLE_HOME
and
LD_LIBRARY_PATH)

restart nagios service to apply configurations.

Finally lets test the plugin in your terminal in libexec directory see below:
oracle _plugins.PNG
Let me know how it goes
Attachments
run_plugin.PNG
clinton92
Posts: 10
Joined: Thu Sep 28, 2017 1:29 pm

Re: check_oracle_health help run

Post by clinton92 »

dwasswa wrote:Hi @ clinton92,

I tested the plugin and got the same error.

Therefore,its a problem with the plugin.

Do you think there's a possible way to fix the error?

I was checking the documentation of this plugin, saw that I need to install DBI::Oracle.

check this guide.

Installation
The installation of the perl-modules DBI and DBD::Oracle is required.

After unpacking the archive ./configure is called. With ./configure –help some options can be printed which show some default values for compiling the plugin.

–prefix=BASEDIRECTORY Specify a directory in which check_oracle_health should be stored. (default: /usr/local/nagios)
–with-nagios-user=SOMEUSER This User will be the owner of the check_oracle_health file. (default: nagios)
–with-nagios-group=SOMEGROUP The group of the check_oracle_health plugin. (default: nagios)
–with-perl=PATHTOPERL Specify the path to the perl interpreter you wish to use. (default: perl in PATH)

https://labs.consol.de/nagios/check_oracle_health/
you can check the url for guides
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health help run

Post by tgriep »

The plugin requires that the Oracle Instant Client to be installed on the Nagios server before installing the DBD::Oracle perl module.

Did you login to the Oracle's Website at www.oracle.com, and download the Oracle Instant Client packages?

Login to Oracle web site and search for the Instant Client for Linux
Download and install the following packages

Code: Select all

Instant Client Basic version 12.2
Instant Client SQLPlus 12.2
Instant Client SDK or Devel 12.2
After they are installed, you will need to setup the environment by running the following as root.

Code: Select all

ORACLE_HOME=/usr/lib/oracle/12.2/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
Then run this to install the DBD::Oracle perl module.

Code: Select all

cpan -i DBD::Oracle
If that doesn't work, try this procedure.

Code: Select all

cd /tmp
wget http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-1.74.tar.gz
tar zxvf DBD-Oracle-1.74.tar.gz
cd DBD-Oracle-1.74
perl Makefile.PL -l
make && make test
make install
Then, you can run the configure from the check_oracle plugin.
The command line options are different for every server and we would need to know which folder you installed Nagios to.

If all goes well, then in Nagios, create the command like the following example.

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib ORACLE_HOME=/usr/lib/oracle/12.2/client $USER1$/check_oracle_health $ARG1$
That will setup the Oracle Environment for the plugin so it will execute correcly.

To test the plugin from the command line, you would do this.

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib ORACLE_HOME=/usr/lib/oracle/12.2/client $USER1$/check_oracle_health --connect=xxx.xxx.xxx.xxx:yyyy/zz --username=oracleusername --password=oraclepassword --mode=connection-time
Replace xxx.xxx.xxx.xxx with the IP address of the server
Replace yyyy with the port the server is listening on
Replace zz with the Oracle SID.

Any questions, errors, post them here as well as which OS and release number for the Nagios server..
Be sure to check out our Knowledgebase for helpful articles and solutions!
clinton92
Posts: 10
Joined: Thu Sep 28, 2017 1:29 pm

Re: check_oracle_health help run

Post by clinton92 »

Thanks everyone.

I've tried your methods however used a different method with regards to installing the instant clients.

as I am current using 2.6.32-504.23.4.el6.i686 #1 SMP Tue Jun 9 18:09:42 UTC 2015 i686 i686 i386 GNU/Linux
]# cat /etc/issue
CentOS release 6.6 (Final)

I've tried this method from oracle

Code: Select all

Installation of ZIP files: 

1. Download the desired Instant Client ZIP files. All installations require the Basic or Basic Light package. 

2. Unzip the packages into a single directory such as /opt/oracle/instantclient_12_2 that is accessible to your application. For example:

cd /opt/oracle			
unzip instantclient-basic-linux.x64-12.2.0.1.0.zip

3. Create the appropriate libclntsh.so and libocci.so links for the version of Instant Client. For example:

cd /opt/oracle/instantclient_12_2
ln -s libclntsh.so.12.1 libclntsh.so
ln -s libocci.so.12.1 libocci.so

4. Install the libaio package, for example on Oracle Linux, run this as the root user:

yum install libaio

On some Linux distributions the package is called libaio1.

5. Set the environment variable LD_LIBRARY_PATH to the directory created in Step 2, for example:

export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH

Alternatively, add this path to an ldconfig configuration file if there is no other Oracle software that will be impacted.

6. To use supplied binaries such as SQL*Plus, update your PATH environment variable, for example:

export PATH=/opt/oracle/instantclient_12_2:$PATH

7. Start your application.
After all the process, I bumped into this error

Code: Select all

/usr/bin/env LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH ORACLE_HOME=/opt/oracle/instantclient_12_2:$PATH /usr/local/nagios/libexec/check_oracle_health --connect=10.130.8.40:5666/WFMPPDB --username=sys --password=ThuC23aD --mode=connection-time
/usr/local/nagios/libexec/check_oracle_health: line 4: syntax error near unexpected token `newline'
/usr/local/nagios/libexec/check_oracle_health: line 4: `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_oracle_health help run

Post by tgriep »

It looks like when the plugin was installed on your system, it was corrupted so replace that plugin with the one that is attached to this post and see if it functions for you.
Remember to remove the .txt extension before running it.
Attachments
check_oracle_health.txt
(217.85 KiB) Downloaded 521 times
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked