I think i installed DBD::Oracle successfully, otherwise, i do not think i could have check this: nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health --connect IGAS --username ABC --password ABC --mode=connection-time
OK - 0.09 seconds to connect as ABC | connection_time=0.0934;1;5

The env variables were set as nagios user, not as root. However there seems to be some sort of env variable problem, but i cannot figure out what.

I deleted the env variables from bashrc of nagios user, and set them globally in /etc/env
nagios@monitor:/usr/local/nagios/etc/Eureko$ cat /etc/environment
PATH="/home/nagios/perl5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/oracle/11.2/client/bin"
ORACLE_HOME="/usr/lib/oracle/11.2/client"
LD_LIBRARY_PATH="/usr/lib/oracle/11.2/client/lib"

And define the following scripts

nagios@monitor:/usr/local/nagios/libexec$ cat *check_oracle_health_time*
#!/bin/bash
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
perl /usr/local/nagios/libexec/check_oracle_health --connect IGAS --username ABC --password ABC --mode=connection-time

nagios@monitor:/usr/local/nagios/libexec$ cat *check_oracle_health_tnsping*
#!/bin/bash
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
perl /usr/local/nagios/libexec/check_oracle_health --connect IGAS --username ABC --password ABC--mode=tnsping -method=sqlplus

Both of this scrips should first set (again) the env variable and then run the desired check_oracle_health plugin.

From CLI, all 4 execution as nagios user works:
nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health_tnsping
OK - connection established to IGAS.
nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health --connect IGAS --username ABC --password ABC --mode=tnsping -method=sqlplus
OK - connection established to IGAS.
nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health_time
OK - 0.09 seconds to connect as ABC | connection_time=0.0897;1;5
nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health --connect IGAS --username iapc_etl --password etl14admin --mode=connection-time
OK - 0.09 seconds to connect as ABC | connection_time=0.0915;1;5


But when defining services in Nagios strange thing happens:

The services defined in Nagios with
check_oracle_health_tnsping and
/check_oracle_health --connect IGAS --username ABC --password ABC --mode=tnsping -method=sqlplus
both work, returning the corect result.

The services defined with
check_oracle_health_time and
check_oracle_health --connect IGAS --username ABC --password ABC --mode=connection-time
both do not work returning:
CRITICAL - cannot connect to IGAS. install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/local/nagios/libexec /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at (eval 13) line 3.


So my question for someone who has made check_oracle_healt work is:
How come all 4 invocation from CLI as nagios user work, but when Nagios runs them, only 2 of them work. I know that the error message tells me that there is some env variable path problem, but why are the first 2 calls of check_oracle_healt work then?




 Cosmin Neagu
 NOC Team Leader
 Str. I. G. Duca nr. 36
 Otopeni, Judetul Ilfov, 075100 Romania
 Tel: 021 303 3159 / 0732 669 193
 www.omnilogic.ro

On 10/29/2012 11:06 AM, Claudio Kuenzler wrote:
You didn't correctly install the DBD::Oracle or your env variables are not correct, as your error message shows it:

Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/local/nagios/libexec /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at (eval 13) line 3.

You said that you have set the paths in .bashrc:

    I also set in .bashrc the enviroment variables:
    export ORACLE_HOME=/usr/lib/oracle/11.2/client
    export PATH=$PATH:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib

You probably set this as root. Don't forget that Nagios runs under its own user! (by default: nagios).



On Mon, Oct 29, 2012 at 9:50 AM, Cosmin Neagu <cosmin.ne...@omnilogic.ro <mailto:cosmin.ne...@omnilogic.ro>> wrote:

    Hi Nagios Users,
    Can someone help me or give a hint on why check_oracle_health does
    not work (as describe below) ?

    On 10/23/2012 04:59 PM, Cosmin Neagu wrote:
    Hi all,

    I manage to install the oracle client on nagios machine after all
    (google is the best) and making all the necesary setting so that
    check_oracle_health is working from command line as nagios user:

    nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health
    --connect IGAS --username abc --password abc --mode=tnsping
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 4163.
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 6167.
    OK - connection established to IGAS.
    nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health
    --connect IGAS --username abc --password abc --mode=connection-time
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 4163.
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 6167.
    OK - 0.10 seconds to connect as iapc_etl | connection_time=0.0968;1;5
    nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health
    --connect IGAS --username abc --password abc --mode=connected-users
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 4163.
    Use of qw(...) as parentheses is deprecated at
    ./check_oracle_health line 6167.
    OK - 31 connected users | connected_users=31;50;100


    The command is defined like this:
    define command{
            command_name check_oracle_health
            command_line $USER1$/check_oracle_health $ARG1$
    }

    And the services:
    define service {
            use                     generic-service
            host_name               DBIGASDS
            service_description     Reachability via tnsping
            check_command           check_oracle_health! --connect
    IGAS --username abc --password abc --mode=tnsping
            contacts                cosmin
    }

    define service {
            use                     generic-service
            host_name               DBIGASDS
            service_description     Connection time to DB
            check_command check_oracle_health!--connect IGAS
    --username abc --password abc mode=connection-time
            contacts                cosmin
    }
    define service {
            use                     generic-service
            host_name               DBIGASDS
            service_description     Connected users to DB
            check_command check_oracle_health!--connect IGAS
    --username abc --password abc mode=connected-users
            contacts                cosmin


    I also set in .bashrc the enviroment variables:
    export ORACLE_HOME=/usr/lib/oracle/11.2/client
    export PATH=$PATH:$ORACLE_HOME/bin
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib


    But, in Nagios 3.4.1, i do not receive the corect status for
    those services:
    For all 3 services i receive:
    CRITICAL - cannot connect to IGAS. install_driver(Oracle) failed:
    Can't locate DBD/Oracle.pm in @INC (@INC contains:
    /usr/local/nagios/libexec /etc/perl /usr/local/lib/perl/5.14.2
    /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5
    /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl
    .) at (eval 13) line 3.


    I realy don't know what to check anymore and why does it say
    that, so any help would be apreciated.

        More info:
    nagios@monitor:/usr/local/nagios/libexec$ ./check_oracle_health -V
    check_oracle_health (1.7.3)
    nagios@monitor:/usr/local/nagios/etc$ uname -a
    Linux monitor 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27
    17:25:43 UTC 2012 i686 i686 i386 GNU/Linux
    nagios@monitor:/usr/local/nagios/etc$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 12.04.1 LTS
    Release:        12.04
    Codename:       precise

      Cosmin Neagu
      NOC Team Leader
      Str. I. G. Duca nr. 36
      Otopeni, Judetul Ilfov, 075100 Romania
      Tel: 021 303 3159 / 0732 669 193
      www.omnilogic.ro  <http://www.omnilogic.ro>
    On 10/03/2012 09:34 AM, Claudio Kuenzler wrote:
    It's not that hard and a lot of things are written in the
    documentation of check_oracle_health.
    I even wrote an article about this in September 2011 explaining
    the steps:
    
http://www.claudiokuenzler.com/blog/192/install-perl-dbd-oracle-DBD::Oracle-on-SuSE-SLES10-without-cpan


    You should do it the way you prefer of course. But in my setup I
    wanted to run check_oracle_health on a standalone Nagios server.
    That way I also see if there's a latency in the remote sql
    query. Real life applications rarely use localhost connections.

    On Wed, Oct 3, 2012 at 8:14 AM, Cosmin Neagu
    <cosmin.ne...@omnilogic.ro <mailto:cosmin.ne...@omnilogic.ro>>
    wrote:

        Well, thats the hard part for me, installing those ORA files
        - didnt find yet how to do that. I think installing the
        plugin on DBServer and using NRPE is easier.

          Cosmin Neagu
          NOC Team Leader
          Str. I. G. Duca nr. 36
          Otopeni, Judetul Ilfov, 075100 Romania
          Tel: 021 303 3159 / 0732 669 193
          www.omnilogic.ro  <http://www.omnilogic.ro>

        On 10/02/2012 06:05 PM, Claudio Kuenzler wrote:

            The plugin needs to be installed on the Oracle Database
            server.


        That's not entirely correct. It can also run on a
        standalone Nagios server.
        But you need to install the ora files to be able to launch
        the plugin against an Oracle DB server.
        I did that successfully on Nagios 3.3.1 against ORA11.



        
------------------------------------------------------------------------------
        Don't let slow site performance ruin your business. Deploy New Relic APM
        Deploy New Relic app performance management and know exactly
        what is happening inside your Ruby, Python, PHP, Java, and .NET app
        Try New Relic at no cost today and get our sweet Data Nerd shirt too!
        http://p.sf.net/sfu/newrelic-dev2dev


        _______________________________________________
        Nagios-users mailing list
        Nagios-users@lists.sourceforge.net  
<mailto:Nagios-users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/nagios-users
        ::: Please include Nagios version, plugin version (-v) and OS when 
reporting any issue.
        ::: Messages without supporting info will risk being sent to /dev/null


        
------------------------------------------------------------------------------
        Don't let slow site performance ruin your business. Deploy
        New Relic APM
        Deploy New Relic app performance management and know exactly
        what is happening inside your Ruby, Python, PHP, Java, and
        .NET app
        Try New Relic at no cost today and get our sweet Data Nerd
        shirt too!
        http://p.sf.net/sfu/newrelic-dev2dev
        _______________________________________________
        Nagios-users mailing list
        Nagios-users@lists.sourceforge.net
        <mailto:Nagios-users@lists.sourceforge.net>
        https://lists.sourceforge.net/lists/listinfo/nagios-users
        ::: Please include Nagios version, plugin version (-v) and
        OS when reporting any issue.
        ::: Messages without supporting info will risk being sent to
        /dev/null




    
------------------------------------------------------------------------------
    Don't let slow site performance ruin your business. Deploy New Relic APM
    Deploy New Relic app performance management and know exactly
    what is happening inside your Ruby, Python, PHP, Java, and .NET app
    Try New Relic at no cost today and get our sweet Data Nerd shirt too!
    http://p.sf.net/sfu/newrelic-dev2dev


    _______________________________________________
    Nagios-users mailing list
    Nagios-users@lists.sourceforge.net  
<mailto:Nagios-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/nagios-users
    ::: Please include Nagios version, plugin version (-v) and OS when 
reporting any issue.
    ::: Messages without supporting info will risk being sent to /dev/null



    
------------------------------------------------------------------------------
    Everyone hates slow websites. So do we.
    Make your web apps faster with AppDynamics
    Download AppDynamics Lite for free today:
    http://p.sf.net/sfu/appdyn_sfd2d_oct


    _______________________________________________
    Nagios-users mailing list
    Nagios-users@lists.sourceforge.net  
<mailto:Nagios-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/nagios-users
    ::: Please include Nagios version, plugin version (-v) and OS when 
reporting any issue.
    ::: Messages without supporting info will risk being sent to /dev/null


    
------------------------------------------------------------------------------
    The Windows 8 Center - In partnership with Sourceforge
    Your idea - your app - 30 days.
    Get started!
    http://windows8center.sourceforge.net/
    what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
    _______________________________________________
    Nagios-users mailing list
    Nagios-users@lists.sourceforge.net
    <mailto:Nagios-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/nagios-users
    ::: Please include Nagios version, plugin version (-v) and OS when
    reporting any issue.
    ::: Messages without supporting info will risk being sent to /dev/null




------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/


_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue.
::: Messages without supporting info will risk being sent to /dev/null

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to