Skip to main content

DB2 Database

Pack Assets​

Monitored Objects​

The Pack DB2 collects metrics for:

  • Connection-time
  • Connected-users
  • Database-logs
  • Database-usage
  • Hadr
  • Tablespaces

Discovery rules​

Rule nameDescription
App-DB-Db2-Tablespace-NameDiscover tablespaces and monitor usage

Collected Metrics​

Metric nameDescriptionUnit
connection.time.millisecondsConnection established timems

Prerequisites​

Install Plugin dependencies​

RPM​

In order to use this Pack, the wget command-line tool and the GNU Compiler Collection (gcc) are necessary.

yum install -y gcc wget ksh

DB2 driver package​

Go to your IBM support website and download the archive data_server_driver_package_linuxx64_v11.5.tar.gz.

Install the archive manually:

tar zxf ibm_data_server_driver_package_linuxx64_v11.5.tar.gz
mv dsdriver/ /opt/
cd /opt/dsdriver/
./installDSDriver
echo "/opt/dsdriver/lib/" > /etc/ld.so.conf.d/db2-x86_64.conf
/sbin/ldconfig

Perl library for DB2​

As root, run:

cd /usr/local/src 
wget https://cpan.metacpan.org/authors/id/R/RO/ROCKETDB/DBD-DB2-1.89.tar.gz
tar zxvf DBD-DB2-1.89.tar.gz
cd DBD-DB2-1.89/
export DB2LIB=/opt/dsdriver/lib/
export DB2_HOME=/opt/dsdriver/
perl Makefile.PL

Compile the library:

make

Install it:

make install

User account​

The safest way to retrieve information from the DB2 server is to create a dedicated user for Centreon.

This user account must have the read permission on following tables:

  • syscat.tablespaces
  • sysibmadm.applications
  • sysibmadm.container_utilization
  • sysibmadm.log_utilization
  • sysibmadm.tbsp_utilization

This user must have the permission to execute the SYSPROC.GET_DBSIZE_INFO procedure.

Eventually, this user must have the authority SYSMON.

Setup​

  1. Install the Centreon Plugin on every Poller:
yum install centreon-plugin-Applications-Databases-Db2
  1. On the Centreon Web interface in Configuration > Monitoring Connector Manager, install the DB2 Database Pack

Host configuration​

  • Add a new Host and apply the App-DB-Db2-custom Host Template

Once the template applied, some Macros have to be configured:

MandatoryNameDescription
XDB2PORTPort used (Default: 50000)
XDB2DATABASEName for the Db2 database system
XDB2USERNAMEDB2 username account
XDB2PASSWORDDB2 password account
DB2EXTRAOPTIONSAny extra option you may want to add to the command (eg. a --verbose flag)

How to test the Plugin and what are the main options for?​

Once the plugin installed, log into your Centreon Poller CLI using the centreon-engine user account and test the Plugin by running the following command (Parameters such as username or passwordhave to be adjusted):

/usr/lib/centreon/plugins/centreon_database_db2.pl \
--plugin=database::db2::plugin \
--mode=database-usage \
--server='10.30.2.79' \
--database='TEST' \
--port='50000' \
--username='myusername' \
--password='mypassword' \
--verbose

Expected command output is shown below:

OK: database 'TEST' space usage total: 99.84 GB used: 698.34 MB (0.68%) free: 99.16 GB (99.32%) | 'TEST#database.space.usage.bytes'=732266496B;;;0;107204739072 'TEST#database.space.free.bytes'=106472472576B;;;0;107204739072 'TEST#database.space.usage.percentage'=0.68%;;;0;100

The command above monitors database space usage (--mode=database-usage).

All the options as well as all the available thresholds can be displayed by adding the --help parameter to the command:

/usr/lib/centreon/plugins/centreon_database_db2.pl \
--plugin=database::db2::plugin \
--mode=database-usage \
--help

Troubleshooting​

Troubleshooting plugins