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
|
||||
|
||||
for x in "${!DRIVES[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVES[$x]}" ; done
|
||||
echo
|
||||
# for x in "${!DRIVES[@]}"; do printf "[%s]=%s\n" "$x" "${DRIVES[$x]}" ; done
|
||||
|
||||
|
||||
# if (( $(bc <<<"$dfreeper <= 15") )); then
|
||||
# fs_status='error'
|
||||
# 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
|
||||
#
|
||||
# elif (( $(bc <<<"$dfreeper <= 25") )); then
|
||||
# fs_status='warn'
|
||||
# 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
|
||||
#
|
||||
# else
|
||||
# fs_status=''
|
||||
# fs_status_color='Green'
|
||||
# fi
|
||||
#
|
||||
# c=0; cw=40; spcA=''
|
||||
# spc1=`expr ${cw} - ${#dname}`
|
||||
# until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
|
||||
#
|
||||
# c=0; cw=12; spcB=''
|
||||
# spc2=`expr ${cw} - ${#dfree}`
|
||||
# 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]}"
|
||||
for DRIVE in "${DRIVES[@]}"; do
|
||||
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= 15") )); then
|
||||
fs_status='error'
|
||||
fs_status_color='Red'
|
||||
#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
|
||||
fs_status='warn'
|
||||
fs_status_color='Yellow'
|
||||
#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
|
||||
fs_status=''
|
||||
fs_status_color='Green'
|
||||
fi
|
||||
|
||||
c=0; cw=40; spcA=''
|
||||
spc1=`expr ${cw} - ${#DRIVE}`
|
||||
until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
|
||||
|
||||
c=0; cw=12; spcB=''
|
||||
spc2=`expr ${cw} - ${#dfree}`
|
||||
until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
|
||||
|
||||
echo -e "${idsCL[$fs_status_color]} ${DRIVE}${spcA}: ${DRIVEINFO_FREE[$DRIVE]} GB Free${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${idsCL[Default]}"
|
||||
done
|
||||
|
||||
else
|
||||
echo -e "${idsCL[Yellow]} ${host_name[$hostid]} is down${idsCL[Default]}"
|
||||
|
||||
Reference in New Issue
Block a user