IBM Support

How to setup the db2evmonfmt tool

Question & Answer


Question

How can you use db2evmonfmt tool to monitor database information?

Cause

The db2evmonfmt tool is a java based tool that requires java to work correctly. This tool must be setup to view unformatted event table data.

Answer

First you must have an event monitor that uses an unformatted event table. This example illustrates how to setup the event monitor for UOW. But this tool can be used for any event monitor that utilizes an unformatted event table.

Example:

1. Create the event monitor.

db2 "create event monitor my_uow_evmon for unit of work write to unformatted event table (in userspace1)"

2. Update the monitor switches.

db2 udpate dbm cfg for DFT_MON_UOW using on

3. Then update the db cfg setting mon_uow_data

db2 update db cfg for dbname using mon_uow_data base

4. Run some queries. To add data to the event monitor table.

5. Setup the db2evmonfmt tool.

Now after an install the java classes and pathes should be setup. So this may be done in your env as well. Check by doing this.

echo $CLASSPATH
echo $PATH
echo $LD_LIBRARY_PATH
java -version
which java


This will show you the paths setup for this. And if you have to alter them. They should look something like this.

echo $CLASSPATH
/home/db2v97/sqllib/java/db2java.zip:/home/db2v97/sqllib/java/sqlj.zip:/home/db2v97/sqllib/function:/home/db2v97/sqllib/java/db2jcc_license_cu.jar:/home/db2v97/sqllib/tools/clpplus.jar:/home/db2v97/sqllib/tools/antlr-3.2.jar:/home/db2v97/sqllib/tools/jline-0.9.93.jar:/home/db2v97/sqllib/java/db2jcc.jar:.


echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/db2v97/sqllib/bin:/home/db2v97/sqllib/adm:/home/db2v97/sqllib/misc:/home/db2v97/sqllib/db2tss/bin:/home/db2v97/bin

echo $LD_LIBRARY_PATH
/home/db2v97/sqllib/lib64:/home/db2v97/sqllib/lib32

java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.9) (rhel-1.36.1.11.9.el5_9-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

which java
/usr/bin/java


If any of these are not setup like this you will have to export them to your env manually.
Like this:

export LD_LIBRARY_PATH=/home/db2v97/sqllib/lib64:/home/db2v97/sqllib/lib32

6. After you verify these paths are correct. Then you need to move the app and compile it. You will need to move these files to the location you will wish to run this at.

pwd
/home/db2v97/sqllib/samples/java/jdbc


cp db2evmonfmt.java /home/db2v97

cp DB2EvmonUOW.xsl /home/db2v97 <-----------------------------You need to copy all the xsl that you plan to use. For this I only did UOW.

7. A java compiler maybe needed, one option would be to use the open java development kit. To install it you must be root and run something similar to:

yum install java-1.6.0-openjdk-devel

Once this is done then you should be able to compile it.

8. After the compiler is installed run the following command to complete the process:

javac db2evmonfmt.java

As the instance id used to create the event.

9. To view the output you can run something like:

java db2evmonfmt -d sample -ue MY_UOW_EVMON -ftext

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Performance - Monitoring Tools","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.8;9.7;10.1;10.5","Edition":"Advanced Enterprise Server;Enterprise Server;Workgroup Server","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21640515