Previously wrote a monitoring script, every 10 seconds using ping to check an IP list of IP, if not, then sent through Messenger message, and the use of beep issued an alarm sound. File Sleep.exe is required (available next to the Web), BEEP. EXE (Oneself with Delphi write, not necessary, the code can be removed, also can go to the Internet to find a), and then set up file Ip.txt,user.txt, run the script can.
Copy Code code as follows:
REM Main.bat
@echo off
For/f "eol=; tokens=1,2* delims== "%%i in" (IP. TXT) do Call:checkip%%i%%j 0
Echo--------------------------------------------------------------
echo----The first round of inspection completed, if not heard the alarm, the IP can be ping----
echo----If you have an abnormal IP, manually use the ping command again to confirm the correctness of the check----
echo----Now do a loop check and check an IP every 10000ms----
Echo--------------------------------------------------------------
: Begin
For/f "eol=; tokens=1,2* delims== "%%i in" (IP. TXT) do Call:checkip%%i%%j 10000
Goto BEGIN
: Checkip
@echo off
PING%1-n 1 | Find "ttl=" >nul
IF not errorlevel 1 ECHO%1 (% 2) Status OK at%time%
IF not errorlevel 1 GOTO NEXT
PING%1-n 1-w 3000 | Find "ttl=" >nul
If%errorlevel%==1 call:send%1%2 ELSE ECHO%1 (% 2) Status OK at%time%
: Next
Sleep%3
Goto END
: Send
@echo off
ECHO%1 (% 2)::::: Status ERROR at%time%::::
for/f "eol=;"%%i in (user. TXT) do net send%%i "Error Pinging%1" (% 2). ">nul
Beep 1500 500
Beep 500 500
Beep 1500 500
Beep 500 500
Goto END
: End
Ip.txt, key IP, one line IP, followed by enter name
192.168.0.1= Group Gateway
192.168.0.123=test
User.txt, computer name or IP, when the network is detected, send a message to the user in the text
ComputerName