Random Project

A litle correction and contrib

change the line:

## Get lv’s and their df’s
for vg in `lvs –noheadings –nosuffix –units b –separator ” ” –options vg_name`; do

for:

for vg in `vgs –noheadings –nosuffix –units b –separator ” ” –options vg_name`; do

For enhanced the output, change the entire block code as above:

## Get lv’s and their df’s
for vg in `vgs –noheadings –nosuffix –units b –separator ” ” –options vg_name`; do
for lv in `lvs –noheadings –nosuffix –units b –separator ” ” –options lv_name $vg`; do
if [[ `mount | grep $vg | grep $lv` ]]; then
dfout=`df -P –block-size=1 | grep $vg | grep $lv`
outper=`echo “$dfout” | grep –only-matching “[0-9]*%”`
outname=”$vg/$lv”
outmount=`echo “$dfout” | awk ‘{print $6}’`
#`echo “$dfout” | awk ‘{ print $1 }’`
outnum=`expr match “$outper” ‘([0-9]*)’`
if [ $thresh_crit ] && [ “$outnum” -ge “$thresh_crit” ]; then
critflag=1
msgs=”$msgs$outname/$outper ($outmount)”
elif [ $thresh_warn ] && [ “$outnum” -ge “$thresh_warn” ]; then
warnflag=1
msgs=”$msgs$outname/$outper ($outmount)”
fi
fi
done
done