Page 1 of 1

Setting up check_db2_health

Posted: Wed Feb 27, 2019 7:08 am
by mejokj
So I have been trying for two days to get check_db2_health to work without any luck. Here's where I am stuck at the moment:

Code: Select all

[nagios@nagios root]$ /usr/local/nagios/libexec/check_db2_health --hostname 192.168.2.10 --port 35001 --username=nagios  --password=nagios --mode=connection-time --database=testdb

CRITICAL - cannot connect to  192.168.2.10. Total Environment allocation failure!  Did you set up your DB2 client environment?

The IBM documentation (https://www.ibm.com/support/knowledgece ... lient.html) says:

For the DB2 client, you must set the environment variables.
For Linux systems, add the environment variables to the bash_profile file of the user.

Set the following environment variables.
DB2DIR= /opt/ibm/db2/V10.5 (Default DB2 directory)
DB2INSTANCE=db2inst1 (default)
INSTHOME=/home/db2inst1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTHOME/sqllib/lib
NLS_LANG

But after installing the client, I don't see a sqllib directory anywhere. I am also not sure which DB2 client package I have to install on the Nagios server and I have tried all the below.

I am confused with the multiple options listed here: http://www.db2dean.com/Previous/DB2Client.html

Which one of these do I need?
IBM Data Server Driver Package (DS Driver)
IBM Data Server Runtime Client
IBM Data Server Client

I believe that I have installed the Perl DBD::DB2 module correctly, or the error when I run the plugin would be different.

This is my first time trying to configure Nagios to monitor DB2 so any suggestions would be appreciated.

Re: Setting up check_db2_health

Posted: Wed Feb 27, 2019 6:04 pm
by ssax
I believe you just need this one:

Code: Select all

IBM Data Server Runtime Client
Does this output anything?

Code: Select all

find / -name sqllib
You may need to add those to /etc/environment on the XI server for them to be processed.

Re: Setting up check_db2_health

Posted: Thu Mar 14, 2019 4:41 am
by mejokj
We got it to work, but it wasn't easy:

1. Install IBM Data server runtime client(ibm_data_server_runtime_client_linuxx64_v11.1.tar.gz) on Nagios server.

2. Install the DB2 server(not client) on another Linux server and then copied the sqllib directory to /opt/ibm/db2/V11.1 on Nagios server. I am not sure if this is the right way, but we couldn't find the sqllib directory anywhere else.

3. Set the following environment variables:

Code: Select all

export DB2_HOME=/opt/ibm/db2/V11.1  
export DB2LIB=$DB2_HOME/lib64  
export LD_LIBRARY_PATH=$DB2LIB:$LD_LIBRARY_PATH 
4. Test

Code: Select all

[root@nagiosxi libexec]# /usr/local/nagios/libexec/check_db2_health --hostname 192.168.0.119 --port 50000 --username=lcuser  --password=password --mode=connection-time --database=SAMPLE WARNING - 2.33 seconds to connect as LCUSER   | connection_time=2.3264;1;5

Re: Setting up check_db2_health

Posted: Thu Mar 14, 2019 7:08 am
by scottwilkerson
mejokj wrote:We got it to work, but it wasn't easy:
Great! Thanks for sharing your solution.

Locking thread