Update dsmon.sh
This commit is contained in:
18
dsmon.sh
18
dsmon.sh
@@ -113,7 +113,7 @@ CHECK(){
|
|||||||
DRIVEINFO=$(ssh root@${host_ip[$hostid]} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|media-data|Software' | awk '{ print $1 " " $2 " " $4 }')
|
DRIVEINFO=$(ssh root@${host_ip[$hostid]} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|media-data|Software' | awk '{ print $1 " " $2 " " $4 }')
|
||||||
DRIVEINFO=(${DRIVEINFO})
|
DRIVEINFO=(${DRIVEINFO})
|
||||||
|
|
||||||
for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done
|
# for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done
|
||||||
|
|
||||||
NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
|
NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
|
||||||
declare -A DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER
|
declare -A DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER
|
||||||
@@ -125,7 +125,7 @@ CHECK(){
|
|||||||
dname=${dname//\/dev\/mapper\//}
|
dname=${dname//\/dev\/mapper\//}
|
||||||
dname=${dname//\/dev\//}
|
dname=${dname//\/dev\//}
|
||||||
|
|
||||||
if [ "${dname}" = "sda1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 102 ]; then
|
if [ "${dname}" = "sda1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||||
systempartition=true
|
systempartition=true
|
||||||
elif [ "${dname}" = "sda2" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
elif [ "${dname}" = "sda2" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||||
systempartition=true
|
systempartition=true
|
||||||
@@ -149,12 +149,12 @@ CHECK(){
|
|||||||
|
|
||||||
IFS=$'\n' DRIVES=($(sort <<<"${DRIVES[*]}")); unset IFS
|
IFS=$'\n' DRIVES=($(sort <<<"${DRIVES[*]}")); unset IFS
|
||||||
|
|
||||||
for x in "${!DRIVEINFO_TOT[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_TOT[$x]}" ; done
|
# for x in "${!DRIVEINFO_TOT[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_TOT[$x]}" ; done
|
||||||
echo
|
# echo
|
||||||
for x in "${!DRIVEINFO_FREE[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_FREE[$x]}" ; done
|
# for x in "${!DRIVEINFO_FREE[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_FREE[$x]}" ; done
|
||||||
echo
|
# echo
|
||||||
for x in "${!DRIVEINFO_FREEPER[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_FREEPER[$x]}" ; done
|
# for x in "${!DRIVEINFO_FREEPER[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO_FREEPER[$x]}" ; done
|
||||||
echo
|
# echo
|
||||||
|
|
||||||
for DRIVE in "${DRIVES[@]}"; do
|
for DRIVE in "${DRIVES[@]}"; do
|
||||||
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= 15") )); then
|
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= 15") )); then
|
||||||
@@ -180,7 +180,7 @@ CHECK(){
|
|||||||
spc2=`expr ${cw} - ${#DRIVEINFO_FREE[$DRIVE]}`
|
spc2=`expr ${cw} - ${#DRIVEINFO_FREE[$DRIVE]}`
|
||||||
until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
|
until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
|
||||||
|
|
||||||
echo -e "${idsCL[$fs_status_color]} ${DRIVE}${spcA}: ${DRIVEINFO_FREE[$DRIVE]} GB Free${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${idsCL[Default]}"
|
echo -e "${idsCL[$fs_status_color]} ${DRIVE}${spcA}: ${DRIVEINFO_FREE[$DRIVE]} GB Free${spcB}${DRIVEINFO_FREEPER[$DRIVE]}% (${DRIVEINFO_TOT[$DRIVE]})${idsCL[Default]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
unset DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER DRIVES DRIVEINFO
|
unset DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER DRIVES DRIVEINFO
|
||||||
|
|||||||
Reference in New Issue
Block a user