#
# 检查系统内存,参数为页面空间使用率阀值、内存空闲页面数阀值
#
rm $TMPDIR/monmem > /dev/null 2>&1
/etc/swap -l | grep -v "swaplo" |awk '{
if ( $5*100/$4 < limit )
{
printf "页面文件使用率过高 %d\n",100-$5*100/$4
system("> $TMPDIR/monmem")
}
}' limit=$1
vmstat 1 1 | grep "1" |awk '{
if ($4 < limit)
{
printf "内存空页过低: %d\n",$4
system(">$TMPDIR/monmem")
}
}' limit=$2
if [ -f $TMPDIR/monmem ]
then
exit 1
else
echo "内存无异常"
exit 0
fi
阅读(1067) | 评论(0) | 转发(0) |