Last active
August 29, 2015 14:02
-
-
Save jiaozhu/ac203fffc9be48adfcaa to your computer and use it in GitHub Desktop.
定期检测操作系统的CPU使用率,如果超过60%,则生成THREADDUMP文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ksh | |
##################################################################### | |
# # | |
# Env:Aix # | |
# Copyright (c) 2014, jiaozhu <[email protected]> # | |
# All rights reserved. # | |
# Distributed under the GNU General Public License, version 3.0. # | |
# # | |
##################################################################### | |
SERVER=$(uname -n) | |
typeset -i CPUHWM=60 | |
typeset -i CPU | |
typeset -i WLPid | |
CPU=$(vmstat 1 1 | tail -1 | awk '{print $14+$15}') | |
getJPid() | |
{ | |
WLPid=$(ps -ef|grep AdminServer|grep -Evi '(grep|startManagedWebLogic.sh)' | awk '{print $2}') | |
echo "I got the WebLogic Server PID : $WLPid" | |
kill -3 $WLPid | |
echo "THREADDUMP GEN COMPL" | |
} | |
if [ $CPU -gt $CPUHWM ]; then | |
echo "CPU exceeded $CPU us+sy percent on $SERVER" | |
getJPid | |
else | |
echo "NOTHING." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment