DB2 Database
Pack Assets​
Monitored Objects​
The Pack DB2 collects metrics for:
- Connection-time
- Connected-users
- Database-logs
- Database-usage
- Hadr
- Tablespaces
Discovery rules​
- Services
Rule name | Description |
---|---|
App-DB-Db2-Tablespace-Name | Discover tablespaces and monitor usage |
Collected Metrics​
- Connection-time
- Connected-users
- Database-logs
- Database-usage
- Hadr
- Tablespaces
Metric name | Description | Unit |
---|---|---|
connection.time.milliseconds | Connection established time | ms |
Metric name | Description | Unit |
---|---|---|
users.connected.count | Number of connected users |
Metric name | Description | Unit |
---|---|---|
db_name~partition_num#database.log.space.usage.bytes | Used space | B |
db_name~partition_num#database.log.space.free.bytes | Free space | B |
db_name~partition_num#database.log.space.usage.percentage | Used space in percentage | % |
Metric name | Description | Unit |
---|---|---|
db_name#database.space.usage.bytes | Used space | B |
db_name#database.space.free.bytes | Free space | B |
db_name#database.space.usage.percentage | Used space in percentage | % |
Metric name | Description | Unit |
---|---|---|
hadr.instances.standby.count | Number of standby instances | |
hadr connection status | The current high availability disaster recovery connection status of the database | |
hadr state | The current high availability disaster recovery state of the database | |
standby_id#hadr.instance.log.gap.bytes | Recent average of the gap between the PRIMARY_LOG_POS value and STANDBY_LOG_POS value | B |
Metric name | Description | Unit |
---|---|---|
tablespace status | Tablespace state | |
db_name~tablespace_name#tablespace.space.usage.bytes | Used space | B |
db_name~tablespace_name#tablespace.space.free.bytes | Free space | B |
db_name~tablespace_name#tablespace.space.usage.percentage | Used space in percentage | % |
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​
- Online License
- Offline License
- Install the Centreon Plugin on every Poller:
yum install centreon-plugin-Applications-Databases-Db2
- On the Centreon Web interface in Configuration > Monitoring Connector Manager, install the DB2 Database Pack
- Install the Centreon Plugin on every Poller:
yum install centreon-plugin-Applications-Databases-Db2
- On the Centreon Central server, install the Centreon Pack from the RPM:
yum install centreon-pack-applications-databases-db2
- 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:
Mandatory | Name | Description |
---|---|---|
X | DB2PORT | Port used (Default: 50000) |
X | DB2DATABASE | Name for the Db2 database system |
X | DB2USERNAME | DB2 username account |
X | DB2PASSWORD | DB2 password account |
DB2EXTRAOPTIONS | Any 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 password
have 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