Monday, May 23, 2016

Stuck Thread Alert in UNIX - Weblogic

Following is the script which can be used to get email alerts in case of stuck threads in weblogic (installed on UNIX machines)

ScriptName: stuckCheckMS1.sh
#!/bin/ksh
 

Somefile=/export/home/oracle/stuckLogs/ms1_stuckCheck.log
 

count="$(/usr/ucb/ps auxwww | grep ms1 | grep Dweblogic | cut -c 10-15 | tr -d ' ' | xargs /opt/oracle/products/wls10.3.6/jdk1.6.0_45/bin/sparcv9/jstack -F | tee /export/home/oracle/stuckLogs/ms1_stuck.log_`/usr/bin/date +\%m-\%d-\%y-\%H-\%M` | grep STUCK | wc -l)"

if [ $count != 0 ]
then
                        echo "\n Server MS1 has stuck threads on" `/usr/bin/date +\%m-\%d-\%y-\%H-\%M` | mail -s 'STUCK thread on MS1' Some1@gmail.com
> $Sfile
else
                        echo "\n stuck threads status=okay" > $Somefile
fi
 

exit

2 comments: