From 4218fabf02afac54825ac8662fceb421855b61c7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 2 Jan 2023 09:36:52 -0600 Subject: [PATCH] Update dsmon.sh --- dsmon.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/dsmon.sh b/dsmon.sh index 0e20b5f..8f8e4d3 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -111,7 +111,7 @@ CHECK(){ checkhost=$(CHECK_HOST ${host_ip[$hostid]}) if [ "${checkhost}" != "false" ]; then - DRIVEINFO=$(ssh root@${host_ip[$hostid]} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|sda|sdb|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}) NUMDRIVES=$((${#DRIVEINFO[@]} / 3)) @@ -123,6 +123,22 @@ CHECK(){ dfreeper=$(printf "%0.2f" $(jq -n ${dfree}/${dtot}*100)) dname=${dname//\/dev\/mapper\//} dname=${dname//\/dev\//} + + if [ "${ia}" = "sda1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + systempartition=true + elif [ "${ia}" = "sda2" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + systempartition=true + elif [ "${ia}" = "shm" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + systempartition=true + elif [ "${ia}" = "nvme0n1p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + systempartition=true + elif [ "${ia}" = "mmcblk0p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + systempartition=true + elif [ "${ia}" != "overlay" ]; then + #echo "${ia};${ib};${ic}" + DRIVE_INFO+=("${ia};${ib};${ic}") + + fi if (( $(bc <<<"$dfreeper <= 15") )); then fs_status='error' @@ -139,10 +155,15 @@ CHECK(){ fs_status_color='Green' fi - c=0; cw=40; spc='' + c=0; cw=40; spcA='' spc1=`expr ${cw} - ${#dname}` - until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - echo -e "${idsCL[$fs_status_color]} ${dname}${spc}: ${dfree}GB Free - ${dfreeper}%${idsCL[Default]}" + until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done + + c=0; cw=12; spcB='' + spc2=`expr ${cw} - ${#dfree}` + until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done + + echo -e "${idsCL[$fs_status_color]} ${dname}${spcA}: ${dfree}GB Free${spcB}- ${dfreeper}% -${idsCL[Default]}" done