I wrote the following little *nix monitoring script when I needed to
know more about a nocturnal critter that was grabbing too much CPU..
Perhaps you can use it. Just put something like this in crontab and
you're off:
#*/3 01-03 * * * (~/sqllib/db2profile 2>&1 > /dev/null ; cd /mydir ;
/mydir/snapshot.sh 2>&1 | mail -s "snapshot" aj)
cheers
aj
CURRENT=$(date '+%F_%T')
echo $CURRENT
FILE="/mydir/snapshot$CURRENT.txt"
top -b -n 1 > $FILE
echo "------------------------------------------------------" >> $FILE
ps -ef >> $FILE
echo "------------------------------------------------------" >> $FILE
netstat >> $FILE
echo "------------------------------------------------------" >> $FILE
/usr/sbin/lsof >> $FILE
echo "------------------------------------------------------" >> $FILE
iostat >> $FILE
echo "------------------------------------------------------" >> $FILE
for agentid in `db2 list applications | awk 'NR > 4 {print $3}'`
do
echo "Agent ID: "$agentid >> $FILE
db2 get snapshot for application agentid $agentid | egrep -i \
"coordinator agent|communication address|process id|login
id|nname|product id|application name|idle time|locks held|cpu time" >>
$FILE
db2 get snapshot for application agentid $agentid >> $FILE
echo
"-----------------------------------------------------------" >> $FILE
done
gzip $FILE