Jump to content

Internet uptime monitor?


Stelen

Recommended Posts

With my last ISP that was terrible for going down, I wrote a command line script to do just that, putting the down and up times into a log file.  It pings the Google DNS every 30 seconds and if it fails to reply three times in a row, it adds a line to the log file that the connection is down along with the time & date.  Once the pings start replying again, it adds another line mentioning when it went up.  It also displays this info on screen:

 

NWE Internet up & down.png

 

To use the script, copy & paste the following into Notepad and save it as "NetTest.bat" somewhere handy, such as on the desktop:

 

@echo off
set Delay=30

echo Connection log script started: %date% %time:~0,5%
echo Connection log script started: %date% %time:~0,5% >>"Outage log.txt"

:repeat
ping -n %Delay% localhost >nul
ping -n 1 www.google.ie >nul &&goto repeat

set OutageTime=%time:~0,5%
set OutageDate=%date%
ping -n 1 www.google.com >nul &&goto repeat
ping -n 1 www.google.com >nul &&goto repeat
echo %date% %time:~0,5% - Internet or DNS connection is down 

:outagerep
ping -n 1 www.google.ie >nul &&goto backonline
goto outagerep

:backonline
set UpDate=
if not "%date%"=="%OutageDate%" set UpDate= %date%
echo Link/DNS outage: %OutageDate% %OutageTime% to%UpDate% %time:~0,5% >>"Outage log.txt"
echo %date% %time:~0,5% - Internet or DNS connection is up 

goto repeat

 

Just double-click the saved file to run it, minimise it and leave it to run in the background..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...