[Linux监控]磁盘空间大小

[Linux监控]磁盘空间大小
echo 192.168.10.69>>ip.list
-------------------------------------------
#!/bin/bash
#注意if和[]之间的空格
rm -f ~/fanr/shell/DiskUsageAlert/out.print
out=$(cat ~/fanr/shell/DiskUsageAlert/ip.list)

echo $out
for _IP in $out
do
        ssh root@$_IP df | grep -vE "none|devfs"|awk '{if(NR>=2 && int($5)>100) print "'$_IP'" ":disk at " $6 " usage is "$5 " large than 90%" }' >> ~/fanr/shell/DiskUsageAlert/out.print

done

print=$(cat ~/fanr/shell/DiskUsageAlert/out.print)

echo $print
if [ "$print" != "" ]
#if[ -s "~/fanr/shell/DiskUsageAlert/out.print" ]
then
        echo 11
        #echo $print| mail -s"Disk Usage Alerter" [email protected]
fi
--------------------------------------------------------------------------------------
crontab DiskUsageAlert.crontab
cat DiskUsageAlert.crontab
#每5分钟运行一次
*/5 * * * * sh /root/fanr/shell/DiskUsageAlert/DiskUsageAlter.sh
参考:
http://liguxk.blog.51cto.com/129038/123555  linux 自动执行 crontab学习笔记
posted on 2014-05-27 14:01  Fanr_Zh 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Amaranthus/p/3754983.html

你可能感兴趣的:([Linux监控]磁盘空间大小)