Update dsmon.sh
This commit is contained in:
14
dsmon.sh
14
dsmon.sh
@@ -111,9 +111,15 @@ CHECK(){
|
|||||||
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
checkhost=$(CHECK_HOST ${host_ip[$hostid]})
|
||||||
if [ "${checkhost}" != "false" ]; then
|
if [ "${checkhost}" != "false" ]; then
|
||||||
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=$(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})
|
for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done
|
||||||
|
echo
|
||||||
IFS=$'\n' DRIVEINFO=($(sort <<<"${DRIVEINFO[*]}")); unset IFS
|
IFS=$'\n' DRIVEINFO=($(sort <<<"${DRIVEINFO[*]}")); unset IFS
|
||||||
|
for x in "${!DRIVEINFO[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVEINFO[$x]}" ; done
|
||||||
|
echo
|
||||||
|
|
||||||
|
DRIVEINFO=(${DRIVEINFO})
|
||||||
|
|
||||||
|
|
||||||
NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
|
NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
|
||||||
|
|
||||||
@@ -145,12 +151,12 @@ CHECK(){
|
|||||||
if (( $(bc <<<"$dfreeper <= 15") )); then
|
if (( $(bc <<<"$dfreeper <= 15") )); then
|
||||||
fs_status='error'
|
fs_status='error'
|
||||||
fs_status_color='Red'
|
fs_status_color='Red'
|
||||||
if [ "${ALERT_EMAIL}" != "" ]; then echo -e "${host_name[$hostid]} - (${host_ip[$hostid]})\n${dname} : ${dfree} GB free\t$(date)" | mail -s "Free Space Critical: '${host_name[$hostid]}'" ${ALERT_EMAIL}; fi
|
#if [ "${ALERT_EMAIL}" != "" ]; then echo -e "${host_name[$hostid]} - (${host_ip[$hostid]})\n${dname} : ${dfree} GB free\t$(date)" | mail -s "Free Space Critical: '${host_name[$hostid]}'" ${ALERT_EMAIL}; fi
|
||||||
|
|
||||||
elif (( $(bc <<<"$dfreeper <= 25") )); then
|
elif (( $(bc <<<"$dfreeper <= 25") )); then
|
||||||
fs_status='warn'
|
fs_status='warn'
|
||||||
fs_status_color='Yellow'
|
fs_status_color='Yellow'
|
||||||
if [ "${ALERT_EMAIL}" != "" ]; then echo -e "${host_name[$hostid]} - (${host_ip[$hostid]})\n${dname} : ${dfree} GB free\t$(date)" | mail -s "Free Space Warning: '${host_name[$hostid]}'" ${ALERT_EMAIL}; fi
|
#if [ "${ALERT_EMAIL}" != "" ]; then echo -e "${host_name[$hostid]} - (${host_ip[$hostid]})\n${dname} : ${dfree} GB free\t$(date)" | mail -s "Free Space Warning: '${host_name[$hostid]}'" ${ALERT_EMAIL}; fi
|
||||||
|
|
||||||
else
|
else
|
||||||
fs_status=''
|
fs_status=''
|
||||||
|
|||||||
Reference in New Issue
Block a user