Cavisson machine agent establishes a connection with the IBM DB2 database server. After establishing the connection with the database, the monitor executes some queries to capture the required stats to get the health status of IBM DB2. To make the connection with IBM DB2, the user needs to provide connectivity credentials to the monitor program, so that it can make the connection to the database.

It also provides end-to-end monitoring of IBM DB2 queries with insights into various aspects, such as Buffer Pool, I/O, Log, Connection, Cache, and Transactions.

IBM DB2 monitors covers a wide range of metrics comprising the following:

- IBM DB2 Generic DB Monitor: This monitor provides insight into system resources, SQL statements, and database performance metrics. In IBM DB2 generic DB monitor, there are the following types of monitors:
  - DB2 Database Availability Stats
  - DB2 Database Space Threshold Stats:
  - DB2 Database Sessions Stats
  - DB2 TBSP Stats
  - DB2 Sequence Stats
  - DB2 Blocked Database Session Stats
  - DB2 Invalid Objects Stats
  - DB2 Long Running SQL Stats
- IBM DB2 Based Monitor: This monitor provides performance monitoring specially designed for IBM DB2 database, offering real-time and historical data for optimizing database performance and resolving performance issues. In IBM DB2 based monitor, there are following types of monitors:
  - DB2 Buffer Pool Stats
  - DB2 Transaction Stats
  - DB2 Cache Stats
  - DB2 IO Activity Stats
  - DB2 Connection Stats
  - DB2 Log Stats

## Platform Supported

DB2 monitors are java based, so it is supported on all OS.

## Prerequisites

1. To make connectivity with IBM DB2, db2jcc4.jar should be present in cmon's class-path.
2. To fetch data, the monitor requires a DB2 host, port, database name, username, and password. We are fetching data from below DB2 tables:

   SYSIBMADM.SNAPDB

   SYSIBMADM.MON_DB_SUMMARY

3. The DB2 user should have privileges of read access to SYSIBMADM Database.
4. 4. Supported IBM DB2 versions are: 9.1, 9.5, 9.7, 10.1, 10.5, 11.1.

## Monitor Group Configuration

### Configuration of IBM DB2 Deployment

To successfully configure IBM DB2 monitors, you are required to fill in the following fields:

- DB Instance: In this field, you have to provide the name of the instance. It is a mandatory field.
- User Name: In this field, you have to provide the name of the user. It is a mandatory field.
- Password: In this field, you have to provide the password for the user. It is a mandatory field.

There are also some Advanced Settings that you can apply and are optional as listed below:

- Alternate JRE Home: In this field, you have to provide the alternate JRE Home Path.
- Add Library Classpath: In this field, you have to provide the Classpath for adding a library.
- Launch As Process: If you want to launch a monitor as a thread, then you have to click on the Launch as Process

Note::

1. To run this monitor with a separate JRE, ‘Alternate JRE Home’ needs to be provided.
2. Make sure db2jcc2.jar should be present on target servers, otherwise data will not be collected by the monitor.

## Common Configuration

All metrics in both monitors have the following common fields which are optional:

- Frequency: Each sample will come in a selected frequency in the graph. It can be 10 secs, 10 minutes, 1 hour, 4 hours, or 1 day.
- Other Arguments: It is for enabling debug mode or passing any extra argument JSON.

## Configuration of IBM DB2 Generic DB Monitor

- Database URL: It is the JDBC URL to the database.
  Example: jdbc:postgresql://<HOST>:<PORT>/<DB_NAME>

## Configuration of IBM DB2 Based Monitor

Provide the following details for configuring IBM DB2 monitors:

- Host Name: In this field, you have to provide the Server IP or Server Name where IBM DB2 server is installed. It is a mandatory field.
- Port: In this field, you have to provide the port on which the IBM DB2 service is running. It is a mandatory field.
- Database Name: In this field, you have to provide the IBM DB2 database that you want to monitor. It is a mandatory field.

## Deploy Monitors

Deploy the configured monitors using our machine agent. The following fields need to be filled in to deploy:

- Tier: Tier is used to select the tier on which the monitor(s) will be deployed. Select the required tier from the drop-down list.
- Server: You can select the server(s) of the selected tier on which the configured monitor(s) will get deployed.

Based on the requirement, you can select any one of the following:

- All: Deploy the configured monitors on all the servers of the selected tier.
- Any: Select any one of the servers where monitors will be deployed.
- Specified Server: Select one or multiple servers of the chosen tier on which the monitor(s) will be deployed. It means that with monitors whether we require all servers, any server, or a specified server.
- Exclude Server: In this field, you have to select one or more servers that you want to exclude.
- Exclude Tier: In this field, you have to select one or more tiers that you want to exclude.

Notes:

- If you want to add more tiers and servers, then you can click on the Add Agent Tier-Server
- Once you have selected all the fields, you have to click on the Add Add button to add the tier and server.
- On clicking the add button, the tier server will be added in the table.
- You can perform the following actions in the table which are listed below:
  1. Edit: In the edit option, you can edit the configuration. To perform this operation, you have to click on the Edit Monitor Configuration Once you have edited the configuration, you have to click on the Update Update button to update the table. You can also click on the
     Cancel Cancel button if you don’t want to edit the window.
  2. Delete: In delete, you can delete the configuration. To perform this operation, you have to click on the Delete
  3. Test Monitor:
     - In test monitor, you have to select tier, server, frequency, and duration from the dialog box and then click on the Test Monitor Once you click on the test button, the test will start and the Open Dashboard Open Dashboard button will be enabled and the monitor log will be displayed.
     - Once you click on the open dashboard button, a new dashboard will open in a separate tab where you can see the data.

## Validation

Once the IBM DB2 monitors are configured, you can validate by either checking the monitor homepage where a section for IBM DB2 monitors along with details like total, running, and failed monitors is given or check for the configured monitors from the metric tree, against the tier/server/instance for which this metric is configured.