Update dsmon.sh

This commit is contained in:
2023-01-02 21:40:00 -06:00
parent 44d00f5a23
commit 251c6f82bb

View File

@@ -11,7 +11,7 @@ RUN(){
if [ "${SERVERMON_ID}" != "" ]; then
if [ "${1}" = "hdd" ]; then
DRIVEINFO=`df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage' | awk '{ print $1 " " $2 " " $4 }'`
DRIVEINFO=$(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))
@@ -35,10 +35,9 @@ RUN(){
systempartition=true
elif [ "${ia}" = "mmcblk0p1" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
systempartition=true
elif [ "${ia}" != "overlay" ]; then
else
#echo "${ia};${ib};${ic}"
DRIVE_INFO+=("${ia};${ib};${ic}")
fi
done
@@ -50,6 +49,7 @@ RUN(){
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}');"
MYSQL_PWD="sysmoninsert" mysql -h mysqldb.scity.us -P 3306 -u sysmoninsert -e "${QRY}"
fi