# 系统CPU监控,参数为CPU空闲阀值
#
rm $TMPDIR/moncpu > /dev/null 2>&1
sar 1 1 | grep -v "SCO" | grep -v "\%" | awk '/[0-9]/' | awk '{
if ( $5 < limit )
{
printf "系统CPU空闲低 U[%d] S[%d] W[%d] IDLE[%d]\n", $2,$3,$4,$5
system("> $TMPDIR/moncpu")
}
}' limit=$1
if [ -f $TMPDIR/moncpu ]
then
exit 1
else
echo "CPU正常"
exit 0
fi
阅读(1681) | 评论(0) | 转发(0) |