Update dsmon.sh
This commit is contained in:
34
dsmon.sh
34
dsmon.sh
@@ -188,21 +188,6 @@ CHECK(){
|
|||||||
WARNING_LEVEL=$(printf "%0.2f" $(jq -n 100-${host_limits_tmp[$DRIVE]}))
|
WARNING_LEVEL=$(printf "%0.2f" $(jq -n 100-${host_limits_tmp[$DRIVE]}))
|
||||||
CRITICAL_LEVEL=$(printf "%0.2f" $(jq -n $WARNING_LEVEL-$WARNING_LEVEL/2))
|
CRITICAL_LEVEL=$(printf "%0.2f" $(jq -n $WARNING_LEVEL-$WARNING_LEVEL/2))
|
||||||
|
|
||||||
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= ${CRITICAL_LEVEL}") )); 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 <= ${WARNING_LEVEL}") )); 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=''
|
c=0; cw=40; spcA=''
|
||||||
spc1=`expr ${cw} - ${#DRIVE}`
|
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
|
||||||
@@ -219,7 +204,24 @@ CHECK(){
|
|||||||
spc4=`expr ${cw} - ${#DRIVEINFO_TOT[$DRIVE]}`
|
spc4=`expr ${cw} - ${#DRIVEINFO_TOT[$DRIVE]}`
|
||||||
until [ $c = ${spc4} ]; do spcD="${spcD} "; c=`expr $c + 1`; done
|
until [ $c = ${spc4} ]; do spcD="${spcD} "; c=`expr $c + 1`; done
|
||||||
|
|
||||||
echo -e "${idsCL[Cyan]} ${DRIVE}${spcA}:${idsCL[$fs_status_color]} ${DRIVEINFO_FREE[$DRIVE]} GB${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${spcC}${DRIVEINFO_TOT[$DRIVE]} GB${spcD}${idsCL[Cyan]}( ${idsCL[Yellow]}${WARNING_LEVEL}%${idsCL[Cyan]} / ${idsCL[Red]}${CRITICAL_LEVEL}%${idsCL[Cyan]} )${idsCL[Default]}"
|
if (( $(bc <<<"${DRIVEINFO_FREEPER[$DRIVE]} <= ${CRITICAL_LEVEL}") )); then
|
||||||
|
fs_status='error'
|
||||||
|
fs_status_color='Red'
|
||||||
|
echo -e "${idsCL[Cyan]} ${DRIVE}${spcA}:${idsCL[$fs_status_color]}${idsST[Bold]} ${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}" != "" ]; 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 <= ${WARNING_LEVEL}") )); then
|
||||||
|
fs_status='warn'
|
||||||
|
fs_status_color='Yellow'
|
||||||
|
echo -e "${idsCL[Cyan]} ${DRIVE}${spcA}:${idsCL[$fs_status_color]} ${DRIVEINFO_FREE[$DRIVE]} GB${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${spcC}${DRIVEINFO_TOT[$DRIVE]} GB${spcD}${idsCL[Cyan]}( ${idsCL[Yellow]}${WARNING_LEVEL}%${idsCL[Cyan]} / ${idsCL[Red]}${CRITICAL_LEVEL}%${idsCL[Cyan]} )${idsCL[Default]}"
|
||||||
|
#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'
|
||||||
|
echo -e "${idsCL[Cyan]} ${DRIVE}${spcA}:${idsCL[$fs_status_color]} ${DRIVEINFO_FREE[$DRIVE]} GB${spcB}${DRIVEINFO_FREEPER[$DRIVE]}%${spcC}${DRIVEINFO_TOT[$DRIVE]} GB${spcD}${idsCL[Cyan]}( ${idsCL[Yellow]}${WARNING_LEVEL}%${idsCL[Cyan]} / ${idsCL[Red]}${CRITICAL_LEVEL}%${idsCL[Cyan]} )${idsCL[Default]}"
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
unset DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER DRIVES DRIVEINFO host_limits_tmp
|
unset DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER DRIVES DRIVEINFO host_limits_tmp
|
||||||
|
|||||||
Reference in New Issue
Block a user