Home Directory Plugins Databases DB2 check_db2_health

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree


6 votes
Current Version
Last Release Date
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI 2009R1
  • Nagios Fusion 2010R1
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
check_db2_health is a plugin which checks the most common metrics of a DB2 database.

$ check_db2_health
Please select a mode
Copyright (c) Gerhard Lausser

Check various parameters of DB2 databases

check_db2_health [-v] [-t ] --hostname --port
--username= --password= --mode=
check_db2_health [-h | --help]
check_db2_health [-V | --version]

the connect string
the db2 user
the db2 user's password
the database you want to check
the warning range
the critical range
the mode of the plugin. select one of the following keywords:
connection-time (Time to connect to the database)
connected-users (Number of currently connected users)
sql (any sql command returning a single number)
database-usage (Used space at the database level)
synchronous-read-percentage (Percentage of synchronous reads)
asynchronous-write-percentage (Percentage of asynchronous writes)
tablespace-usage (Used space at the tablespace level)
tablespace-free (Free space at the tablespace level)
bufferpool-hitratio (Hit ratio of a buffer pool)
bufferpool-data-hitratio (Hit ratio of a buffer pool (data pages only))
bufferpool-index-hitratio (Hit ratio of a buffer pool (indexes only))
index-usage (Percentage of selects that use an index)
stale-table-runstats (Tables whose statistics haven't been updated for a while)
deadlocks (Number of deadlocks per second)
lock-waits (Number of lock waits per second)
lock-waiting (Percentage of the time locks spend waiting)
sort-overflows (Number of sort overflows per second (Sorts needing temporary tables on disk))
sort-overflow-percentage (Percentage of sorts which result in an overflow)
log-utilization (Log utilization for a database)
last-backup (Time (in days) since the database was last backupped)
list-databases (convenience function which lists all databases)
list-tablespaces (convenience function which lists all tablespaces)
list-bufferpools (convenience function which lists all buffer pools)

the name of the tablespace, datafile, wait event,
latch, enqueue, or sql statement depending on the mode.
if name is a sql statement, this statement would appear in
the output and the performance data. This can be ugly, so
name2 can be used to appear instead.
if this parameter is used, name will be interpreted as a
regular expression.
one of %, KB, MB, GB. This is used for a better output of mode=sql

You can use the plugin to execute arbitrary sql statements, like
check_db2_health --mode sql --name "select whatever from whatever" --warning 10 --critical 20
You can also extend the plugin with small pieces of perl code if you have very specific requirements in your company or if you want to monitor a certain application.
Reviews (3)
byangoca, July 14, 2020
It checks some aspects of Db2, from a primitive perspective.
This script was not written by a dba, and it does not have the view from the administrative aspect of db2.
The code still have parts from Oracle, so this is not focused in Db2, but like porting.
The script does not support HADR, a minimum for a production environment.
It does not reuses connection, and it can be aggressive when monitoring multiple aspects.
The documentation does not include what grants or permissions are necessary to make it work.
It has a SQL replication part, that could be handy, it is not widely used. Instead, the script lacks mechanism to monitor other elements of Db2.
Script bombs out. Looks like it may be dependent on a different version of DBD::DB2. Doesn't like DBD::DB2::Server::Instance
bykennedto, January 9, 2015
Installed with no issues. Can use it to monitor all my DB2 servers. Only needed to install it on Nagios server to do this. For each host that has DB2 to monitor, just add free variables to allow connection to its DB2 server.