Submitted By: Anonymous Submission
Periodically checks to see if your Windows server is available on the network.
:BEGIN net view \\servername :: replace "servername" with the name of the server you wish to monitor IF ERRORLEVEL==1 goto HELP sleep 30 :: set the sleep time to how often in SECONDS, you want the checking to run. goto BEGIN :HELP Blat ServerDOWN.txt -to yourpager@yourpagerco.com -s "Server appears to be hung!" -server smtphost.yourco.com -f Server-server@yourco.com :: This is the email alert which is sent to your pager, cell, or e-mail. I use Blat but others like Fastmail also work fine. :: ServerDOWN.txt is a text file explaining the problem like "ServerX is DOWN! Please check.", put in a pager, cell, or e-mail address. :: Also change the smtp host name and reply address. :: NOTE if you're checking a mail server, you should not use that server as your smtp host in the above command. sleep 1800 :: This sets the time in SECONDS after the initial alert, to wait before checking the server again. :: You will get repeated pages until the problem is fixed so don't set this too low. goto BEGIN
:BEGIN net view \\servername :: replace "servername" with the name of the server you wish to monitor IF ERRORLEVEL==1 goto HELP sleep 30 :: set the sleep time to how often in SECONDS, you want the checking to run. goto BEGIN :HELP Blat ServerDOWN.txt -to yourpager@yourpagerco.com -s "Server appears to be hung!" -server smtphost.yourco.com -f Server-server@yourco.com :: This is the email alert which is sent to your pager, cell, or e-mail. I use Blat but others like Fastmail also work fine. :: ServerDOWN.txt is a text file explaining the problem like "ServerX is DOWN! Please check.", put in a pager, cell, or e-mail address. :: Also change the smtp host name and reply address. :: NOTE if you're checking a mail server, you should not use that server as your smtp host in the above command. sleep 1800 :: This sets the time in SECONDS after the initial alert, to wait before checking the server again. :: You will get repeated pages until the problem is fixed so don't set this too low. goto BEGIN