Technical Blog Post
Abstract
75 ways to demystify DB2 #57: Techtip : How to collect debug trace for DB2 TSA HADR monitor script - hadr_monitor.ksh
Body
hadr_monitor.ksh is a shell script which TSA calls to monitor HADR database resources. There could be some requirement that we need to trace this shell script e.g.if we need to find some problematic db2 or rsct commands in this script.
To enable the debug function for the script, following the steps:
1. collect lsrsrc -Ab IBM.Application
2. Identify the resource name and the monitor script commnand from lsrsrc output.
e.g.
Name = "db2_DB2ADMIN_DB2ADMIN_SAMPLE-rs"
MonitorCommand = "/usr/sbin/rsct/sapolicies/db2/hadr_monitor.ksh DB2ADMIN DB2ADMIN SAMPLE"
3. Add the following two lines to file /usr/sbin/rsct/sapolicies/db2/hadr_monitor.ksh on both hosts
20 echo "###### $(date)"
21 set -x
4. as root, on both hosts
4.1 Set the cluster management scope to peer domain.
export CT_MANAGEMENT_SCOPE=2
4.2 Turn on verbose mode for for the monitor script and redirect the debug trace to /tmp/hadr_monitor_SAMPLE.shell.out.
chrsrc -s "Name like 'db2_DB2ADMIN_DB2ADMIN_SAMPLE-rs'" IBM.Application MonitorCommand="/usr/sbin/rsct/sapolicies/hadr_monitor.ksh DB2ADMIN DB2ADMIN SAMPLE verbose>> /tmp/hadr_monitor_SAMPLE.shell.out 2>&1"
5. After the issue reoccurs, collect the following data.
getsadata -all from both hosts
/tmp/hadr_monitor_SAMPLE.shell.out
UID
ibm11140952