From fae75c4aa26a743ea2ad77b770628f50461d4b4f Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 2 Jan 2023 15:56:34 -0600 Subject: [PATCH] Update dsmon.sh --- dsmon.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dsmon.sh b/dsmon.sh index 4aa5ba8..5b3c8c7 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -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