From f75d13d1dfaf187d4a46a418032418e42a1e4bfa Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 25 Feb 2024 11:01:23 -0600 Subject: [PATCH] update --- defaults.inc | 2 +- dsmon.sh | 30 +++++++++--------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/defaults.inc b/defaults.inc index ec211f7..7704972 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS=2.3.30-02192024 +VERS=2.3.32-02252024 DS_FOLDER=/opt/idssys/dsmon DS_CRONTAB_FOLDER=/opt/idssys/nodemgmt/crontabs diff --git a/dsmon.sh b/dsmon.sh index f597250..db16f3b 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -31,21 +31,13 @@ RUN(){ ia=${ia//\/dev\/mapper\//} ia=${ia//\/dev\//} - if [ "${ia}" = "sda1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then - systempartition=true - elif [ "${ia}" = "sda14" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then - systempartition=true - elif [ "${ia}" = "sda15" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then - systempartition=true - elif [ "${ia}" = "sda2" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + if [[ "${ia}" = *"sda"* ]] && [ ${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 + elif [[ "${ia}" = *"nvme"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true - elif [ "${ia}" = "nvme1n1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 4096 ]; then - systempartition=true - elif [ "${ia}" = "mmcblk0p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + elif [[ "${ia}" = *"mmcblk"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true elif [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true @@ -193,7 +185,7 @@ RUN_CHECK(){ host_limits_tmp[$hlname]=$hllim done - DRIVEINFO=$(ssh root@${host_ip[$hostid]} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|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|overlay|-volume|Music|Software' | awk '{ print $1 " " $2 " " $4 }') DRIVEINFO=(${DRIVEINFO}) # for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done @@ -211,19 +203,15 @@ RUN_CHECK(){ dname_short=${dname_short%*_v} [ "$dname_short" = "" ] && dname_short=$dname - if [ "${dname}" = "sda1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + if [[ "${ia}" = *"sda"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true - elif [ "${dname}" = "sda14" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + elif [ "${ia}" = "shm" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true - elif [ "${dname}" = "sda15" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + elif [[ "${ia}" = *"nvme"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true - elif [ "${dname}" = "sda2" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + elif [[ "${ia}" = *"mmcblk"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true - elif [ "${dname}" = "shm" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then - systempartition=true - elif [ "${dname}" = "nvme0n1p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then - systempartition=true - elif [ "${dname}" = "mmcblk0p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then + elif [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then systempartition=true else dtot=$(bc <<< "scale=2; ${DRIVEINFO[$((${ii}+1))]}/1024/10")