您好,登錄后才能下訂單哦!
郵件監控存儲卷空間的腳本:
說明:
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。