Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > Contribution: ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 8792 of 9056
Post > Topic >>

Contribution: quick monitoring script

by aj <ronald@[EMAIL PROTECTED] > Apr 15, 2008 at 12:01 AM

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
 




 1 Posts in Topic:
Contribution: quick monitoring script
aj <ronald@[EMAIL PROT  2008-04-15 00:01:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 21:42:25 CDT 2008.