-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_heap_check_v0.2.sh
More file actions
33 lines (23 loc) · 1.15 KB
/
java_heap_check_v0.2.sh
File metadata and controls
33 lines (23 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
curHrMin=`date +"%H:%M"`
MAXHEAPLIMIT=70.99
pid=`ps -ef | grep "weblogic.Server" | grep -v $curHrMin |awk -F ' ' '{print $2}' | head -1`
ec=`/products/jdk1.7/bin/jstat -gc $pid | tail -1 | awk -F ' ' '{print $5}'`
eu=`/products/jdk1.7/bin/jstat -gc $pid | tail -1 | awk -F ' ' '{print $6}'`
eUsage=$(echo "scale=6;$eu/$ec" | bc)
ePer=$(echo "scale=6;$eUsage*100" | bc)
echo "Current Eden Space (HEAP)="$ePer
if [ "$(echo $ePer '>' 99.99 | bc -l)" -eq 1 ]
then
echo "Load on Eden Space is" ${ePer}%
fi
pc=`/products/jdk1.7/bin/jstat -gc $pid | tail -1 | awk -F ' ' '{print $9}'`
pu=`/products/jdk1.7/bin/jstat -gc $pid | tail -1 | awk -F ' ' '{print $10}'`
pUsage=$(echo "scale=6;$pu/$pc" | bc)
PPer=$(echo "scale=6;$pUsage*100" | bc)
echo "Current PermGenSpace Usage="$PPer
#if [ "$(echo $PPer '>' 69.99 | bc -l)" -eq 1 ]
if (( $(echo "$PPer > $MAXHEAPLIMIT" |bc -l) ));
then
echo "Load on PermGen Space is" ${PPer}%
echo -e "Hi All \n\n PermGen Threshold of 99.99% exceeded and the usage detected is ${PPer}% \n\n Thanks & Regards,\n SSO AM Team"| mailx -s "Alert!! in $HOSTNAME - Interface connection status" v.a.cherukuri@accenture.com
fi