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
-
Log into the Db2® pod:
oc exec -it db2u-pod -- bash
-
Log into the Db2 or Db2 Warehouse instance as the db2inst1 user:
-
Navigate to the folder where the db2mon.sh script is present
cd ${BLUMETAHOME}/db2inst1/sqllib/pd/db2mon/
-
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
-
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.