Update dsmon.sh
This commit is contained in:
29
dsmon.sh
29
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user