邮件监控存储卷空间的脚本
邮件监控存储卷空间的脚本:
创新互联公司2013年开创至今,是专业互联网技术服务公司,拥有项目成都网站建设、网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元綦江做网站,已为上家服务,为綦江各地企业和个人服务,联系电话:18980820575
说明:
1、显示存储名、ip、卷名、total空间、free空间、1天用空间、已用百分比
2、对卷名字符数的统计(echo aa1 | wc -m)
3、对卷名部分的排除,只保留数值部分(/usr/lib64/nagios/plugins/check-netapp-ng2.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $5}' | tr -d ';' | cut -b "$Wcc-$Wf")
4、KB转换为GB(echo $Tootal | awk '{$1/=1024*1024;printf "%.0fGB\n",$1})
#!/bin/bash
Date=`date +%Y%m%d`
Date2=`date +%Y%m%d -d "7 days ago"`
Date3=`date +%Y%m%d -d "1 days ago"`
Nas_all="10.0.0.16 10.0.18 10.0.1.11"
eNas1="aa1 aa2 aa3"
eNas2="bb1 bb2 bb3"
#echo "nas1(10.0.0.16) each volume usage" > /log/vol/$Date.log
echo " " > /log/vol/$Date.log
for eNas in $eNas1
do
Wc=`echo /vol/$eNas/ | wc -m`
Wcc=$(($Wc + 1))
Avg=`/usr/lib64/nagios/plugins/check-netapp-ng.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $7}' | cut -b 6-8 | tr -d ';'`
Free=`/usr/lib64/nagios/plugins/check-netapp-ng2.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $5}' | tr -d ';'`
Wf=`echo $Free | wc -m`
Frree=`/usr/lib64/nagios/plugins/check-netapp-ng2.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $5}' | tr -d ';' | cut -b "$Wcc-$Wf"`
Freee=`echo $Frree | awk '{$1/=1024*1024;printf "%.0fGB\n",$1}'`
Total=`/usr/lib64/nagios/plugins/check-netapp-ng3.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $5}' | tr -d ';'`
Wt=`echo $Total | wc -m`
Tootal=`/usr/lib64/nagios/plugins/check-netapp-ng3.pl -H 10.0.0.16 -C public -T DISKUSED -v /vol/$eNas/ -w 80 -c 90 | awk -F[:" "]+ '{print $5}' | tr -d ';' | cut -b "$Wcc-$Wt"`
Totall=`echo $Tootal | awk '{$1/=1024*1024;printf "%.0fGB\n",$1}'`
Dfree=`echo $Freee | tr -d 'GB'`
Yfree=`cat /log/vol/$Date3.log | grep 10.0.0.16 | grep $eNas | head -n 1 | awk -F[:" "]+ '{print $6}' | tr -d 'GB'`
Ufree=$(($Yfree - $Dfree))
echo "nas1(10.0.0.16) $eNas Total: $Totall Free: $Freee Day_use: $Ufree"GB" $Avg" >> /log/vol/$Date.log
done
echo " " >> /log/vol/$Date.log
echo " " >> /log/vol/$Date.log
当前文章:邮件监控存储卷空间的脚本
链接分享:http://cdiso.cn/article/jejgdi.html