diff --git a/dsmon.sh b/dsmon.sh index 8d7b53b..d30110c 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -17,7 +17,7 @@ RUN(){ if [ "${SERVERMON_ID}" != "" ]; then if [ "${1}" = "hdd" ]; then - DRIVEINFO=$(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=$(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=(${DRIVEINFO}) NUMDRIVES=$((${#DRIVEINFO[@]} / 3)) @@ -62,7 +62,7 @@ RUN(){ elif [ "${1}" = "sys" ]; then - MEMORY=$(free -m | awk 'NR==2{printf "%.2f\t\t", ${3}*100/${2} }') + MEMORY=$(free -m | awk 'NR==2{printf "%.2f\t\t", $3*100/$2 }') CPU=$(top -bn1 | grep load | awk '{printf "%.2f\t\t\n", $(NF-2)}') QRY="USE servermonitor; INSERT INTO sysinfo (\`host\`, \`entry\`, \`value\`) VALUES ('${SERVERMON_ID}','sys','${CPU// /};${MEMORY}');" @@ -144,7 +144,7 @@ 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|mmcblk|overlay|-volume|Music|Software' | awk '{ print $1 " " $2 " " $4 }') DRIVEINFO=(${DRIVEINFO}) # for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done