Brothers,
I've been messing around with a custom SMTP script. The reason is
that I would like to set alert levels based on the time it takes for
the SMTP server to answer. The meat of the script is such:
OUTPUT=`command time -o /tmp/time.temp $BBHOME/bin/bbnet
"10.5.101.7:25"`
TIME_RESULTS=`cat /tmp/time.temp | grep "elapsed" | awk '{print $3}'
| cut -d: -f2 | sed 's/elapsed//' | cut -d. -f1`
if [ "${TIME_RESULTS}" -ge "30" ];
then
COLOR="red"
MESSAGE="
Telnet timeout exceeded 30 seconds!
Actual Completion Time: ${TIME_RESULTS}"
elif [ "${TIME_RESULTS}" -gt "15" -a ${TIME_RESULTS} -lt "30" ];
then
COLOR="yellow"
MESSAGE="
Telnet timeout warning!
Actual Completion Time: ${TIME_RESULTS}"
else
COLOR="green"
MESSAGE="
Telnet normal.
Actual Completion Time: ${TIME_RESULTS}"
fi
I blocked SMTP traffic from BBNET so I could test this out. What's
happening is after 20 seconds bbnet returns and the script (because
it took 20 seconds) marks status as yellow. Since I blocked smtp
traffic I would want that status to be red (should take longer than
20 seconds). Is this possible? Any ideas out there how I can
improve this script?