toxinu

Nagios Oracle health plugin

Posted on 28 October 2011

This is more a memo than an article. A quick and dirty check_oracle_health plugin installation, with prerequires.

Developped by Gerhard Lausser, an active Shinken developper with Jean Gab├Ęs.

Like most of Nagios plugins, it’s in Perl language and it’s use DBD::Oracle module, and this module need an Oracle client.

Oracle Instant Client

You have to create a fucking Oracle account… Yes I know you think :

“What’s this great article ?! Proprietary software are just awesome!”.

Go to Oracle Instant Client Downloads Page. Get the Instant Client Package - Basic and sdk. Or use my personnal links above.

For the story, i have fucked my brain during three hours cause I have download the Instant Client Package - Basic Lite and try to work with a Western American charset database… And of course, Basic Lite does not support it.

Derp.

# x86
wget http://dl.socketubs.net/nagios/oracle/instantclient-basic-linux-11.2.0.3.0.zip
wget http://dl.socketubs.net/nagios/oracle/instantclient-sdk-linux-11.2.0.3.0.zip
# X86_64
wget http://dl.socketubs.net/nagios/oracle/instantclient-basic-linux.x64-11.2.0.3.0.zip
wget http://dl.socketubs.net/nagios/oracle/instantclient-sdk-linux.x64-11.2.0.3.0.zip

unzip instantclient-basiclite-linux*.zip
unzip instantclient-sdk-linux*.zip
mv instantclient_11_2 /opt

DBD::Oracle

Install pre-requires :

apt-get install libaio-dev
cpan DBI

Get module sources.

wget http://search.cpan.org/CPAN/authors/id/P/PY/PYTHIAN/DBD-Oracle-1.56.tar.gz
tar xvf DBD-Oracle-1.56.tar.gz
cd !$

DBD::Oracle module need path to Oracle Instant Client.

export ORACLE_HOME=/opt/instantclient_11_2
export LD_LIBRARY_PATH=$ORACLE_HOME
echo 'ORACLE_HOME="/opt/instantclient_11_2"' >> /etc/environment
echo 'LD_LIBRARY_PATH=$ORACLE_HOME' >> /etc/environment

And compile it.

perl Makefile.PL -V 11.2
make
make install

Tnsnames.ora

This file contain informations about your different databases.

mkdir -p /opt/instantclient_11_2/network/admin
vim !$/tnsnames.ora

This is and example of tnsnames.ora file :

<addressname> =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(Host = <hostname>)(Port = <port>))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = <sid>)
 )
)

check_oracle_health

To finish, we have to install the Nagios plugin.

wget http://labs.consol.de/wp-content/uploads/2011/09/check_oracle_health-1.7.6.1.tar.gz
tar xvf check_oracle_health-1.7.6.1.tar.gz
cd !$
./configure
make
make install

That’s all !