Problems Pluggin check_oracle_tbs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

I have installed check_oracle_tbs plugin in my server Nagios, and I defined new command to check autoextend tablespaces:


define command{
command_name check_oracle_tbs
command_line $USER1$/check_oracle_tbs -SID=$ARG1$ -dbuser=$ARG2$ -dbpassword=$ARG3$ -w=$ARG4$ -c=$ARG5$ -wauto=$ARG6$
}

And I defined new service:

#Service definition
define service{
use Servicios-BBDD
host_name host
service_description Tablespace_Autoextend
max_check_attempts 2
normal_check_interval 10
retry_check_interval 3
notification_options c,r
check_period ORATEST
notification_period ORATEST
check_command check_oracle_tbs!inst!usu!pwd!80!90!80
}

But when I monitoring this, appear "no data" message. But i executed this, from Nagios Server in command line:

OK: remaining free space = 14619.44Mb

Regards,
Monica
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems Pluggin check_oracle_tbs

Post by scottwilkerson »

This usually has to do with ORACLE environment variables for the nagios user.

When you run it from the commandline you are likely using root as the user, however when Nagios runs it it is running as the nagios user.

You can simulate this by running

Code: Select all

su nagios -c '/usr/local/nagios/libexec/check_oracle_tbs -SID=inst -dbuser=usu -dbpassword=pwd -w=80 -c=90 -wauto=80'
Usually if you add your ORACLE environment variables to the nagios user it should work
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Re: Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

If i executed command:

su nagios -c '/usr/local/nagios/libexec/check_oracle_tbs -SID=inst -dbuser=usu -dbpassword=pwd -w=80 -c=90 -wauto=80'

appear this error:

install_driver(Oracle) failed: Can't load '/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /tools/home/capmau/libexec/check_oracle_tbs line 102


But If I logged with nagios user, appear this error:

DBI connect('=inst','usu',...) failed: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at /usr/local/nagios/libexec/check_oracle_tbs line 102
CRITICAL: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)

I try, executed, command with nagios user, it's correctly:

OK: remaining free space = 14617.88Mb

In .profile Nagios user, I add:

export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.5/client/lib:/home/oracle/client10.2.0/lib

Regards,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems Pluggin check_oracle_tbs

Post by scottwilkerson »

To be clear, does this mean it is working correctly after you added the LD_LIBRARY_PATH ?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Re: Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

I added LD_LIBRARY_PATH, but indicated errors are occurring after adding entry in .profile nagios user in server. Have I add anything in monitoring agent?

Regards.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems Pluggin check_oracle_tbs

Post by scottwilkerson »

I believe this needs to be added to
/home/nagios/.bashrc

Code: Select all

echo "export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.5/client/lib:/home/oracle/client10.2.0/lib" >> /home/nagios/.bashrc
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Re: Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

I add line in the file and executed command again, baut the result is the same.

Regards.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problems Pluggin check_oracle_tbs

Post by scottwilkerson »

Can you compare

Code: Select all

# env
to

Code: Select all

su nagios -c 'env'
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Re: Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

This is the output, with user nagios (my user is capmau)


#env
HOSTNAME=monitor01
SHELL=/bin/bash
TERM=vt100
HISTSIZE=1000
USER=capmau
LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.5/client/lib:/home/oracle/client10.2.0/lib
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
KDEDIR=/usr
TNS_ADMIN=/home/oracle/client10.2.0/network/admin
MAIL=/var/spool/mail/capmau
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/tools/home/capmau/bin:/tools/home/capmau/bin:/tools/home/capmau/sbin:/home/oracle/client10.2.0/bin:/usr/lib/oracle/10.2.0.5/client/lib:/home/oracle/client10.2.0/lib
INPUTRC=/etc/inputrc
PWD=/tools/home/capmau
LANG=en_US.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/tools/home/capmau
LOGNAME=capmau
LESSOPEN=|/usr/bin/lesspipe.sh %s
ORACLE_HOME=/home/oracle/client10.2.0
G_BROKEN_FILENAMES=1
_=/bin/env
OLDPWD=/tools/home/capmau

su capmau -c 'env'
HOSTNAME=monitor01
SHELL=/bin/bash
TERM=vt100
HISTSIZE=10000
SSH_CLIENT=::ffff:10.52.58.10 3269 22
SSH_TTY=/dev/pts/1
USER=capmau
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
SSH_AUTH_SOCK=/tmp/ssh-uytfFuV768/agent.768
KDEDIR=/usr
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
MAIL=/var/spool/mail/root
_=/bin/env
PWD=/root
INPUTRC=/etc/inputrc
LANG=en_US.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/tools/home/capmau
SHLVL=2
LOGNAME=capmau
SSH_CONNECTION=::ffff:10.52.58.10 3269 ::ffff:10.17.32.61 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
HISTFILE=/var/adm/history/.sh_history___20120221:115832
G_BROKEN_FILENAMES=1

Regards.
msanbrug
Posts: 58
Joined: Fri Nov 04, 2011 7:40 am

Re: Problems Pluggin check_oracle_tbs

Post by msanbrug »

Hello,

I modified check_oracle_tbs, because libexec directoty is not correctly:

use lib "/tools/home/capmau/libexec";

and i add:

$ENV{TNS_ADMIN} = '/home/oracle/client10.2.0/network/admin';

$ENV{LD_LIBRARY_PATH} = '/usr/lib/oracle/10.2.0.5/client/lib:/home/oracle/client10.2.0/lib';

If I executed, from line command:

su - capmau -c '/tools/home/capmau/libexec/check_oracle_tbs -SID=sid -dbuser=user -dbpassword=pwd -w=80 -c=90 -wauto=80
OK: remaining free space = 14611.12M

Have I modify anymore in check_oracle_tbs?

Regards.
Locked