Enabling Db2 or Db2 Warehouse monitoring

You can use the db2mon tool to collect monitoring data on your Db2 or Db2 Warehouse databases in Red Hat OpenShift and Kubernetes.

About this task

The db2mon.sh shell script provides a sampling of data collection and analysis. The script also checks that the prerequisites for db2mon are met. The db2mon.sh script is packaged with Db2 or Db2 Warehouse and can be found in the ${BLUMETAHOME}/db2inst1/sqllib/pd/db2mon/ directory.

For more information, see Collecting and reporting performance monitor data with db2mon.

Procedure

Note: If your deployment uses the restricted-v2 SCC, commands that require switching users or elevated privileges are not supported. Perform all steps as the Db2 instance user within the container. For more information, see Deploying Db2 or Db2 Warehouse with non-root deployment.

  1. Log into the Db2® pod:
    oc exec -it db2u-pod -- bash
  2. Log into the Db2 or Db2 Warehouse instance as the db2inst1 user:
    su - db2inst1
  3. Navigate to the folder where the db2mon.sh script is present
    cd ${BLUMETAHOME}/db2inst1/sqllib/pd/db2mon/
  4. Issue the following command as the db2inst1 user to run the db2mon.sh script:
    db2mon.sh dbname > /tmp/db2mon.out

    Where dbname is the name of the database to be monitored.

    By default, the script collects MON_GET data over a 30-second period. The script can take a second optional argument to collect data over a different period, which is specified in seconds. For example, to produce an online report that collects performance data for 120 seconds:

    db2mon.sh dbname 120 > /tmp/db2mon-120s.out
  5. To copy the report from the Db2 or Db2 Warehouse container to the host, you can run the following command:
    oc cp db2u-podname:/tmp/output-filename destination-path

    Where destination-path is the path on the host where you want to copy the report to.