Nagios Oracle Monitoring

image_pdfimage_print

https://help.ubuntu.com/community/Oracle%20Instant%20Client

https://assets.nagios.com/downloads/nagiosxi/docs/Installing-Oracle-Plugins-in-Nagios-XI.pdf

установка DBD:ORACLE

http://usestrict.net/2009/07/install-dbdoracle-and-oracle-instant-client-on-ubuntu/

 

проверяем подключение к базе

root@srv-monitor:~# sqlplus64 system/manager1@//172.19.10.139:1521/orcl

нефига

sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory

задаем переменную какую то

root@srv-monitor:~# export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

О, запахало!!!

root@srv-monitor:~# sqlplus64 system/manager1@//172.19.10.139:1521/orcl

 


 

Introduction

 

 

Oracle Instant Client is a free Oracle database client. The current version is 12.1.0.2.0, and several versions back to 10.1.0.5 are available.

Install RPMs

 

  • Download the Oracle Instantclient RPM files fromhttp://www.oracle.com/technetwork/database/features/instant-client/index-097480.html. Everyone needs either «Basic» or «Basic lite», and most users will want «SQL*Plus» and the «SDK».

  • Convert these .rpm files into .deb packages and install using «alien» («sudo apt-get install alien» if you don’t have it).

  • For example, for version 12.1.0.2.0-1 for Linux x86_64 (64-bit):
    <span id="line-1" class="anchor"></span>alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
    <span id="line-2" class="anchor"></span>alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
    <span id="line-3" class="anchor"></span>alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

     

  • Test your Instantclient install by using «sqlplus» or «sqlplus64» to connect to your database:
<span id="line-1-1" class="anchor"></span>sqlplus username/password@//dbhost:1521/SID

 

If you execute sqlplus and get «sqlplus: command not found», see the section below about adding the ORACLE_HOME variable.

If sqlplus complains of a missing libsqlplus.so file, follow the steps in the section «Integrate Oracle Libraries» below.

If sqlplus complains of a missing libaio.so.1 file, run

<span id="line-1-2" class="anchor"></span>sudo apt-get install libaio1

 

or, if you’re installing the 32 bit instant client on 64 bit,

<span id="line-1-3" class="anchor"></span>sudo apt-get install libaio1:i386

 

Integrate Oracle Libraries

 

If oracle applications, such as sqlplus, are complaining about missing libraries, you can add the Oracle libraries to the LD_LIBRARY_PATH each time it is used:

<span id="line-1-4" class="anchor"></span>export LD_LIBRARY_PATH=/usr/lib/oracle/&lt;version&gt;/client(64)/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

 

For example, 12.1 version for Linux x86_64:

<span id="line-1-5" class="anchor"></span>export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

 

or to add it to the system library list create a new file as follows:

<span id="line-1-6" class="anchor"></span>sudo vi /etc/ld.so.conf.d/oracle.conf &amp;&amp; sudo chmod o+r /etc/ld.so.conf.d/oracle.conf

 

  • and add the oracle library path as the first line. For example,
<span id="line-1-7" class="anchor"></span>/usr/lib/oracle/12.1/client64/lib/

 

  • or
<span id="line-1-8" class="anchor"></span>/usr/lib/oracle/11.2/client/lib/

 

  • Then run ldconfig:
<span id="line-1-9" class="anchor"></span>sudo ldconfig

 

ORACLE_HOME

 

Many Oracle database applications look for Oracle software in the location specified in the environment variable ‘ORACLE_HOME’.

Typical workstations will only have one Oracle install, and will want to define this variable in a system-wide location.

<span id="line-1-10" class="anchor"></span>sudo sudo vi /etc/profile.d/oracle.sh &amp;&amp; sudo chmod o+r /etc/profile.d/oracle.sh

 

Add the following:

<span id="line-1-11" class="anchor"></span>export ORACLE_HOME=/usr/lib/oracle/&lt;version&gt;/client(64)

 

For example

<span id="line-1-12" class="anchor"></span>export ORACLE_HOME=/usr/lib/oracle/12.1/client64

 

Alternatively, each user can define this in their ~/.bash_profile

Note: From Ubuntu 11.04 (confirmed in 11.04 and 14.04) sqlplus was not recognized as a command unless the following line was also included in the oracle.sh file:

<span id="line-1-13" class="anchor"></span>export PATH=$PATH:$ORACLE_HOME/bin

 

SDK fix

 

Some packages may look for ‘oci.h’ in $ORACLE_HOME/include, or in $ORACLE_HOME/rdbms/public

The instant client sometimes places the include files, such as oci.h, in /usr/include/oracle/<version>/client.

Inspect your system by running the following commands

<span id="line-1-14" class="anchor"></span>ls $ORACLE_HOME
<span id="line-2-1" class="anchor"></span>ls -d /usr/include/oracle/*/client*/*

 

If there is no ‘include’ directory under ORACLE_HOME, and it is located over in /usr/include/oracle/ , create a symbolic link to assist packages looking for these header files. For example,

<span id="line-1-15" class="anchor"></span>sudo ln -s /usr/include/oracle/11.2/client $ORACLE_HOME/include

 

or:

<span id="line-1-16" class="anchor"></span>sudo ln -s /usr/include/oracle/12.1/client64 $ORACLE_HOME/include

 

And then check it is correct

<span id="line-1-17" class="anchor"></span>ls $ORACLE_HOME

Оставьте комментарий