Introduction to Linux - A Hands on Guide | Linux Bible | Linux From Scratch | A Newbie's Getting Started Guide to Linux | Linux Command Line Cheat Sheet | More Linux eBooks



Sunday, 5 October 2014

Nagios XI : Oracle Client Installation and Configuration


Step 1: NRPE Linux Agent Installation

Install nrpe agent on Target database server. Make sure that all ‘oracle’ related plugins are available in ‘/usr/local/nagios/libexec’ directory. Otherwise, download them from Nagios Exchange.

Step 2: Oracle Instant Client Installation

Create an account on ‘www.oracle.com’, navigate to ‘Downloads’ -> ‘Oracle Instant Client’. Select the proper OS version and architecture (say, Linux x86_64). Download the following files and store them in ‘/tmp’ directory:

  • oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
  • oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
  • oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm

Step 3: Download & Execute the Oracle Install Script 

sudo reboot
cd /tmp 
wget http://assets.nagios.com/downloads/general/scripts/oracleinstall.sh 
chmod +x oracleinstall.sh 
./oracleinstall.sh 
NOTE: Make sure that the Nagios Monitoring Server is connected to internet, as the script will try to download some Perl modules through CPAN.

In the end, it will display two variables, which must be saved somewhere as they will be needed later on:

ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib

Step 4: Replacing the Variables

In Nagios XI web interface, navigate to ‘Configure’ -> ‘Core Config Manager’ -> ‘Commands’.

Search for the following commands:

  • check_xi_oraclequery
  • check_xi_oracleserverspace
  • check_xi_oracletablespace
Edit them and replace the ORACLE_HOME and LD_LIBRARY_PATH variables with the values provided by oracleinstall.sh script.

Using any Oracle Wizard, start monitoring Oracle database server.

ERROR:
 

Remedy:

Install DBD::Oracle Module through CPAN as follows:

export ORACLE_HOME=<path to your Oracle which was given by the script>
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
cpan -i DBD::Oracle 
While installing above module, following error might come:

Installing on a linux, Ver#2.6
Using Oracle in /usr/lib/oracle/12.1/client64
DEFINE _SQLPLUS_RELEASE = "1201000200" (CHAR)
Oracle version 12.1.0.2 (12.1)

        Unable to locate an oracle.mk or other suitable *.mk
        file in your Oracle installation.  (I looked in
        /usr/lib/oracle/12.1/client64/rdbms/demo/demo_xe.mk /usr/lib/oracle/12.1/client64/rdbms/lib/oracle.mk /usr/lib/oracle/12.1/client64/rdbms/demo/oracle.mk /usr/lib/oracle/12.1/client64/rdbms/demo/demo_rdbms.mk /usr/lib/oracle/12.1/client64/rdbms/demo/demo_rdbms64.mk /usr/lib/oracle/12.1/client64/rdbms/lib/ins_rdbms.mk /usr/share/oracle/12.1/client64/demo.mk under /usr/lib/oracle/12.1/client64)

        The oracle.mk (or demo_rdbms.mk) file is part of the Oracle
        RDBMS product.  You need to build DBD::Oracle on a
        system which has one of these Oracle components installed.
        (Other *.mk files such as the env_*.mk files will not work.)
        Alternatively you can use Oracle Instant Client.

        In the unlikely event that a suitable *.mk file is installed
        somewhere non-standard you can specify where it is using the -m option:
                perl Makefile.PL -m /path/to/your.mk

        See the appropriate README file for your OS for more information and some alternatives.

     at Makefile.PL line 1187.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
  PYTHIAN/DBD-Oracle-1.74.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

In that case, you will have to download tar file from - http://search.cpan.org/~pythian/DBD-Oracle-1.74/lib/DBD/Oracle.pm

Execute following series of commands:

tar -xvzf DBD-Oracle-xx.xx.tar.gz
cd DBD-Oracle-xx.xx perl
Makefile.PL -l
make && make test
make install
Result:

$ /usr/local/nagios/libexec/check_oracle_health --connect 'xx.xx.xx.xx:1521/TESTDB2' --username 'system' --password 'system@123' --mode connection-time --warning 1 --critical 5

OK - 0.66 seconds to connect as SYSTEM | connection_time=0.6561;1;5

1 comment:

  1. need to fix your formatting on
    cd DBD-Oracle-xx.xx perl
    Makefile.PL -l

    to

    cd DBD-Oracle-xx.xx
    perl Makefile.PL -l

    ReplyDelete