#!/bin/sh
DIR="/home/admin"
cd $DIR
if [ $? -ne 0 ]
then
echo "there have no logfile DIR,please check the DIR's existence."
exit 2
fi
MAXFILE_SIZE=`ls -lS $DIR | grep -v total | head -1 | awk '{print $5}'`
if [ $MAXFILE_SIZE -gt 838860800 ]
then
echo `ls -lS $DIR | grep -v total | head -1 | awk '{print $9}'` "is larger than 800M"
exit 2
else
echo "That's ok,all logfile are not larger than 800M"
exit 0
fi
这里的文件大小是800M,如果有文件大于800M 就报警,通过snmp来调用这个脚本,用check_snmp脚本的-r ok来检测有没关键字ok来进行处理
非常简单
阅读(746) | 评论(0) | 转发(0) |