shell脚本第三篇——监控主机的磁盘空间,当使用空间超过90%就通过发mail来发警告

时间:2018-01-18 16:45:27   收藏:0   阅读:409
shell脚本第三篇——监控主机的磁盘空间,当使用空间超过90%就通过发mail来发警告

#!/bin/bash
#monitor available disk space
#提取本服务器的IP地址信息
IP=`ifconfig eth0 | grep "inet addr" | cut -f 2 -d ":" | cut -f 1 -d " "`
SPACE=` df -hP | awk '{print int($5)}'`
if [ $SPACE -ge 90 ]
then
  echo "$IP 服务器 磁盘空间 使用率已经超过90%,请及时处理。"| mail -s "$IP 服务器硬盘告警" lili@163.com
fi


原文:http://blog.51cto.com/13571706/2062488

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!