Logging your connectivity

I had a message this morning from a friend who was having intermittent disconnection issues on their internet. The network itself was fine and, when using another provider, that too was working so it came down to evidence gathering to support the case to the ISP to investigate.

As a quick throw together, we came up with the following using wget and a batch file to repeat the command every x minutes.

For *nix:

wget --tries=30 --waitretry=30 --no-proxy --user-agent="Mozilla/5.0" --append-output=./ConnectionLog.txt --output-document=./DownloadedFileIsHere.txt http://[URL_to_a_file_on_a_server_you_are_allowed_to_make_repeated_requests_to] 

*OR* for Windows:

wget --tries=30 --waitretry=30 --no-proxy --user-agent="Mozilla/5.0" --append-output=C:\ConnectionLog.txt --output-document=C:\DownloadedFileIsHere.txt http://[URL_to_a_file_on_a_server_you_are_allowed_to_make_repeated_requests_to]

What the above does is this:

wget get me a file
–tries=30 try 30 times before you give up
–waitretry=30 wait 30 seconds between attempts (this allows for the router to reconnect)
–no-proxy don’t use a proxy (we want to test the connection, not a local copy of the file)
–user-agent=”Mozilla/5.0″ pretend to be a browser (many web servers will block requests from automated tools)
–append-output=[PathToWritableDirectory]/ConnectionLog.txt write the output of the command to a file, appending it to previous output, for later analysis. You could get a bit clevererish and reduce the verbosity of the output to give you less text to read through, but for the purposes of a quick and easy, this will do.
–output-document=[PathToWritableDirectory]/FileIsHere.txt Copy the file to a known location, overwrite if it exists (because we don’t want to be prompted to replace things)
http://[URL]/[Filename] The actual file you want to retrieve. Be sure to use a server under your control, or at least friendly to repeated requests. Many servers will do analysis of repeated requests and start to block addresses that continually ask for resources.

 


Posted

in

, ,

by