[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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。