DB2, How does iQSonar find it
Problem
Capture the details of what iQSonar looks for to measure DB2
Solution
So the trace only, is because (most likely) that we see a running process, but either cant find, or cant access the details to create a FoundApplication.
No FoundApplication = No connection string = no connection attempt.
As discussed, the following might be of some help:
this.Add("DB2Ports", @"(ps ax|awk '/db2sysc *$|db2gds *$/{print $1}'|while read PID
do
ls -l /proc/$PID/exe 2>/dev/null| awk '{gsub(/.* -> |\/adm\/db2.*/,"""",$0);print $0 ""|""}'
done;
[ -x /usr/local/bin/db2ls ] && /usr/local/bin/db2ls | awk 'NR>3{print $1 ""|"" $2}'
)|uniq|while read DB2HINT
do
DB2PATH=${DB2HINT%|*}
INSTNAME=`$DB2PATH/bin/db2 'get dbm cfg'|awk -F= '/(SVCENAME)/{gsub(/ */,"""",$2);print $2}'`
[ ""$INSTNAME"" != """" ] && PORT=`sed -n -e ""/$INSTNAME\s/s:.*\s\([0-9]*\)/tcp.*$:\1:p"" /etc/services`
for DBNAME in `$DB2PATH/bin/db2 list database directory | awk -F= '/Database name/{print $2}'`
do
echo ""IBM|DB2|$DB2HINT|$INSTNAME|$DBNAME|$PORT""
done
done;
");
This is the only DB2 code I can find from available 2.14 code, might be helpful.
We look for likely services (db2sysc / db2gds) and get the process id from these…
Attempt to find the path based on the running service.
Hit up the path just found to grab the instance name
Then check /etc/services for the port based on the path info.
Related articles
Filter by label
There are no items with the selected labels at this time.