From 5e658a2fb633f7d5d0396b6d2f3d94045c64ee8e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 3 Apr 2025 18:01:10 -0500 Subject: [PATCH] Update dsmon.sh --- dsmon.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dsmon.sh b/dsmon.sh index a0ede47..8dd1837 100755 --- a/dsmon.sh +++ b/dsmon.sh @@ -297,9 +297,10 @@ RUN_CHECK(){ unset DRIVEINFO_TOT DRIVEINFO_FREE DRIVEINFO_FREEPER DRIVEINFO_SHORTNAME DRIVES DRIVEINFO host_limits_tmp - if [[ "$(ssh -o BatchMode=yes -o ConnectTimeout=3 root@${host_ip[$hostid]} du -hs /var/log/mail.log | cut -d'/' -f 1)" = *'M'* ]]; then + maillogsize=$(ssh -o BatchMode=yes -o ConnectTimeout=3 root@${host_ip[$hostid]} du -hs /var/log/mail.log | cut -d'/' -f 1) + if [[ "${maillogsize}" = *'M'* ]]; then if [ ! -f /tmp/dsmon.mail-log.${host_ip[$hostid]}.errorsent ] || ([ -f /tmp/dsmon.mail-log.${host_ip[$hostid]}.errorsent ] && [ $(expr $(date +%s) - $(stat -c %Y /tmp/dsmon.mail-log.${host_ip[$hostid]}.errorsent)) -gt 3600 ]); then - SENDNOTICE "Mail Log Getting Big" "Mail log getting big on hostname [${host_ip[$hostid]}]" 1 + SENDNOTICE "Mail Log Getting Big" "Mail log getting big (${maillogsize// /}) on hostname [${host_ip[$hostid]}]" 1 touch /tmp/dsmon.mail-log.${host_ip[$hostid]}.errorsent fi elif [ -f /tmp/dsmon.mail-log.${host_ip[$hostid]}.errorsent ]; then