Update dsmon.sh
This commit is contained in:
54
dsmon.sh
54
dsmon.sh
@@ -146,34 +146,34 @@ CHECK(){
|
|||||||
|
|
||||||
IFS=$'\n' DRIVES=($(sort <<<"${DRIVES[*]}")); unset IFS
|
IFS=$'\n' DRIVES=($(sort <<<"${DRIVES[*]}")); unset IFS
|
||||||
|
|
||||||
for x in "${!DRIVES[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVES[$x]}" ; done
|
# for x in "${!DRIVES[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVES[$x]}" ; done
|
||||||
echo
|
|
||||||
|
|
||||||
|
for DRIVE in "${DRIVES[@]}"; do
|
||||||
# if (( $(bc <<<"$dfreeper <= 15") )); then
|
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= 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${DRIVE} : ${DRIVEINFO_FREE[$DRIVE]} 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${DRIVE} : ${DRIVEINFO_FREE[$DRIVE]} GB free\t$(date)" | mail -s "Free Space Warning: '${host_name[$hostid]}'" ${ALERT_EMAIL}; fi
|
||||||
#
|
|
||||||
# else
|
else
|
||||||
# fs_status=''
|
fs_status=''
|
||||||
# fs_status_color='Green'
|
fs_status_color='Green'
|
||||||
# fi
|
fi
|
||||||
#
|
|
||||||
# c=0; cw=40; spcA=''
|
c=0; cw=40; spcA=''
|
||||||
# spc1=`expr ${cw} - ${#dname}`
|
spc1=`expr ${cw} - ${#DRIVE}`
|
||||||
# until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
|
||||||
#
|
|
||||||
# c=0; cw=12; spcB=''
|
c=0; cw=12; spcB=''
|
||||||
# spc2=`expr ${cw} - ${#dfree}`
|
spc2=`expr ${cw} - ${#dfree}`
|
||||||
# until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
|
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]}"
|
echo -e "${idsCL[$fs_status_color]} ${DRIVE}${spcA}: ${DRIVEINFO_FREE[$DRIVE]} GB Free${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${idsCL[Default]}"
|
||||||
|
done
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${idsCL[Yellow]} ${host_name[$hostid]} is down${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]} ${host_name[$hostid]} is down${idsCL[Default]}"
|
||||||
|
|||||||
Reference in New Issue
Block a user