diff --git a/dsmon.sh b/dsmon.sh index 93224e2..afe095c 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -222,6 +222,8 @@ CHECK(){ fs_status_color='Green' fi + D_WARNING_LEVEL=$(bc <<< "scale=2; 100-${WARNING_LEVEL}") + D_CRITICAL_LEVEL=$(bc <<< "scale=2; 100-${CRITICAL_LEVEL}") [ "${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]}$(expr 100 - ${WARNING_LEVEL})%${idsCL[Cyan]} / ${idsCL[RedBold]}$(expr 100 - ${CRITICAL_LEVEL})%${idsST[Reset]}${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}