9/min run get_max_mem_process.sh
if swap >= 3G or thread number >= 1800. then colloect the information. modified: install_shell/crontab modified: install_shell/get_max_mem_process.sh Signed-off-by: Qin, Bo <bqin@linx-info.com>
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
#!/bin/bash
|
||||
LOAD_AVERAGE_15_MINUTES=$(uptime|awk -F ',' '{print $5}'|awk -F '.' '{print $1}')
|
||||
if [ ${LOAD_AVERAGE_15_MINUTES} -ge 20 ];then
|
||||
swap=$(free -g|grep "^Swap:"|awk '{print $3}')
|
||||
thread_num=$( top -b -H -n 1|grep "^Tasks:"|awk '{print $2}')
|
||||
|
||||
# swap >= 3G or thread_num >= 1800
|
||||
if [ ${swap} -ge 3 -o ${thread_num} -ge 1800 ];then
|
||||
date>>/var/log/messages
|
||||
echo "rss(KB) pmem%M pcpu%C vsize(SWAP+RES,KB) process ">>/var/log/messages
|
||||
ps -eo rss,pmem,pcpu,vsize,args | sort -k 1 -r -n|head -10>>/var/log/messages
|
||||
top -b -n 1 -d 10 >> /var/log/messages
|
||||
top -H -b -n 1 -d 10 >> /var/log/messages
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user