Ignoring single Timeouts
In
some cases it is not desirable to send an alarm notification at
the first occurrence of a timeout. An internet connection can
sometimes have temporarily long response times. That is not necessarily
an indication for a serious problem.
This
article describes how to configure SLCheck to perform a user defined
action not at the first, but at the second occurrence of a timeout.
We assume that there is a scheduled task that performs SLCheck
commands in regular intervals, e.g. once a minute.
SLCheck -a
ftp-server -p 21 -r "220" -d FTP -SLFile FTP\FTP.csv
"-d
FTP" indicates that we use the .cmd files from subdirectory
c:\SLCheck\FTP. We have to copy them to that location manually and
modify them like described later. "-SLFile FTP\FTP.csv"
tells SLCheck to log all results to c:\SLCheck\FTP\FTP.csv.
SLCheck
has no brain. That means that a SLCheck command doesn't know
anything about the result of the previous command. So we have to
create that brain in the form of a file flag. We would like to
monitor a FTP server. If the request to the FTP server times out, we
create an empty "flag file" that indicates that a timeout has happened. This is our CheckTimeout.cmd
file:
if exist FTP-Timeout.flag (
blat.exe ... "FTP server not running..."
)
else echo "..." >FTP-Timeout.flag
blat.exe
is our mail notifier. The echo command creates a file named
FTP-Timeout.flag.
Here
is the CheckOK.cmd file. It should delete our flag file if it
exists:
if exist FTP-Timeout.flag
del FTP-Timeout.flag
Maybe
the FTP-Timeout.flag file is located in a path you don't want, e.g.
in the system32 folder. You can specify the full path name in that
case (c:\SLCheck\...).
With these batch commands we have achieved that SLCheck works in a generous
mode. The first occurrence of a timeout will be ignored. If there
are two consecutive timeouts, the alarm notification will be sent.
|