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>
12 lines
438 B
Bash
Executable File
12 lines
438 B
Bash
Executable File
#!/bin/bash
|
|
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 -H -b -n 1 -d 10 >> /var/log/messages
|
|
fi
|