Quantcast
Channel: Java mon amour
Viewing all articles
Browse latest Browse all 1121

Count stuck threads in WebLogic

$
0
0
nice little script to count the stuck threads in all instances of WebLogic (or any other Java processes) running under the current user:



#!/bin/bash


CURRENTUSER=`whoami`
echo "pid user stuck"
ps -ef | grep java | grep -v grep | while read LINE
do
SOAUSER=$(echo $LINE | awk '{print $1}')
if [ $SOAUSER == $CURRENTUSER ]
then
PID=$(echo $LINE | awk '{print $2}')
NAME=$(echo $LINE | sed -n -e 's/.*-Dweblogic.Name=\([^ ]*\).*/\1/p')
if [ -z "$NAME" ] ; then
NAME=$(echo $LINE | sed -n -e 's/.*weblogic.\(NodeManager\).*/\1/p')
fi
if [ -z "$NAME" ] ; then
NAME="UnknownApp"
fi
STUCKCOUNT=`jstack $PID | grep "STUCK" | wc -l`
echo "PID=" $PID "NAME=" $NAME "STUCKCOUNT" $STUCKCOUNT
fi
done



Viewing all articles
Browse latest Browse all 1121

Trending Articles