Update dsmon.sh

This commit is contained in:
2023-01-02 15:56:34 -06:00
parent 364f949489
commit fae75c4aa2

View File

@@ -174,13 +174,13 @@ CHECK(){
c=0; cw=20; spcA=''
spc1=`expr ${cw} - 5`
until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
c=0; cw=10; spcB=''
c=0; cw=8; spcB=''
spc2=`expr ${cw} - 4`
until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
c=0; cw=10; spcC=''
spc3=`expr ${cw} - 5`
until [ $c = ${spc3} ]; do spcC="${spcC} "; c=`expr $c + 1`; done
c=0; cw=12; spcD=''
c=0; cw=14; spcD=''
spc4=`expr ${cw} - 3`
until [ $c = ${spc4} ]; do spcD="${spcD} "; c=`expr $c + 1`; done
echo -e "${idsST[Reset]}${idsCL[White]} DRIVE${spcA} FREE GB${spcB}FREE %${spcC}TOTAL GB${spcD}WARN % / CRIT %${idsCL[Default]}"
@@ -199,7 +199,7 @@ CHECK(){
c=0; cw=20; spcA=''
spc1=`expr ${cw} - ${#DRIVEINFO_SHORTNAME[$DRIVE]}`
until [ $c = ${spc1} ]; do spcA="${spcA} "; c=`expr $c + 1`; done
c=0; cw=10; spcB=''
c=0; cw=8; spcB=''
spc2=`expr ${cw} - ${#DRIVEINFO_FREE[$DRIVE]}`
until [ $c = ${spc2} ]; do spcB="${spcB} "; c=`expr $c + 1`; done
c=0; cw=10; spcC=''
@@ -222,7 +222,7 @@ CHECK(){
fs_status_color='Green'
fi
[ "${1}" != "report" ] && echo -e "${idsCL[Cyan]} ${DRIVEINFO_SHORTNAME[$DRIVE]}${spcA}:${idsCL[$fs_status_color]} ${DRIVEINFO_FREE[$DRIVE]} GB${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${spcC}${DRIVEINFO_TOT[$DRIVE]} GB${idsST[Reset]}${spcD}${idsCL[Cyan]}( ${idsCL[Yellow]}${WARNING_LEVEL}%${idsCL[Cyan]} / ${idsCL[Red]}${CRITICAL_LEVEL}%${idsCL[Cyan]} )${idsCL[Default]}"
[ "${1}" != "report" ] && echo -e "${idsCL[Cyan]} ${DRIVEINFO_SHORTNAME[$DRIVE]}${spcA}${idsCL[$fs_status_color]}${DRIVEINFO_FREE[$DRIVE]} GB${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${spcC}${DRIVEINFO_TOT[$DRIVE]} GB${idsST[Reset]}${spcD}${idsCL[Cyan]}( ${idsCL[Yellow]}${WARNING_LEVEL}%${idsCL[Cyan]} / ${idsCL[Red]}${CRITICAL_LEVEL}%${idsCL[Cyan]} )${idsCL[Default]}"
if [ "${ALERT_EMAIL}" != "" ] && [ "${fs_status}" != "Normal" ] && [ "${1}" = "report" ]; then
echo -e "${host_name[$hostid]} - (${host_ip[$hostid]})\n\n${DRIVE} : ${DRIVEINFO_FREE[$DRIVE]}GB out of ${DRIVEINFO_TOT[$DRIVE]}GB Free (${DRIVEINFO_FREEPER[$DRIVE]}%)\n\n$(date)" | mail -s "Free Space ${fs_status}: '${host_name[$hostid]}'" ${ALERT_EMAIL}
fi