0
awk関数を含むisi-storagepool --list -v
を実行して、何らかの計算を行い、最後にデータを出力するストレージレポートを取得しています。awk関数内でmultipalコマンドを実行
現在の作業コマンド
isi storagepool list -v |awk 'function num2gb(n) { if (n ~ /T$/) return n/1; return n/1024; }
/Requested Protection:/ { parity=substr($NF,length($NF)-1,1) }
/Nodes:/ { nodes=$NF }
/HDD Total/ { hdd_total=$NF }
/HDD Used/ { hdd_used=num2gb($NF) }
END {
multiplier=nodes-parity
total=hdd_total/nodes*multiplier
used=hdd_used/nodes
eu=used*multiplier*0.8
et=total*0.8
used1=eu/et*100
print "parity =" parity
print "NodeNumber =" nodes
print "Total = " total " TB"
print "Effective Total volume = " total*0.8 " TB"
print "USED =" used1 " %"
print "Effective used=" used*multiplier*0.8 " TB"
print "Available volume=" (hdd_total-hdd_used)/nodes*multiplier*0.8 " TB" }'
現在の作業コマンドの出力例
parity =1
NodeNumber =3
Total = 37.3013 TB
Effective Total volume = 29.8411 TB
USED =333975%
Effective used=534360 TB
Available volume=-534330 TB
今、我々は、以下のコマンドから取得します上記のサンプル出力にいくつかのより多くの情報を追加したいです。
# isi_classic snapshot usage | tail -n 1
358G n/a (R) 0.63% (T)
要求出力はとして
parity =1
NodeNumber =3
Total = 37.3013 TB
Effective Total volume = 29.8411 TB
USED =333975%
Effective used=534360 TB
Available volume=-534330 TB
Snapshot USED = 358G # added output from the new command # isi_classic snapshot usage
Snapshot USED % = 0.63% # added output from the new command # isi_classic snapshot usage