ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 写了一个监控文件系统空间使用的脚本

写了一个监控文件系统空间使用的脚本

原创 Linux操作系统 作者:lsq_008 时间:2008-09-10 15:11:24 0 删除 编辑
echo "">>/tmp/mon.stat.tmp
echo "">>/tmp/mon.stat.tmp
DAY=`date +%Y-%m-%d`
echo "Today is $DAY,now checking the filesystem's space_usage.........">>/tmp/mon.stat.tmp
df -h|grep -v Filesystem|grep -v none>/root/data
echo "=========================================">>/root/mon.stat.tmp
        echo "The follwing Filesystem's usage is great 80%">>/root/mon.stat.tmp
        echo "=========================================">>/root/mon.stat.tmp
df -h|grep Filesystem>>/root/mon.stat.tmp
cat /root/data | while read check
do
echo $check>tmp.txt
STATUS_OUT=`cat tmp.txt|awk '{print $5}'|sed -n 's/%//gp'`
echo ${check}
echo $STATUS_OUT
if [ $STATUS_OUT -gt 60 ]; then
        echo $check>>/root/mon.stat.tmp
fi
 
done
echo "+++++++++++++++++++++++++++++++++++++++++++++">>/root/mon.stat.tmp
echo "+The filesystem's total space_usage         +">>/root/mon.stat.tmp
echo "+++++++++++++++++++++++++++++++++++++++++++++">>/root/mon.stat.tmp
        df -h >>/root/mon.stat.tmp

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10972173/viewspace-442889/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
十余年大型金融及电信系统数据库管理经验,曾服务于中国建设银行、中国移动。对oracle,mysql数据库有深入了解。 擅长python开发,独立开发了开源数据库自动化监控运维平台Power Monitor。

注册时间:2008-02-29

  • 博文量
    335
  • 访问量
    1369113