07 July, 2010

Automated internet speed check (using external FTP)

Hi,

I wanted to check the internet speed every week to be sure that we don't have any reduction from what the ISP should give us.

Asked the ISP for a FTP location and wrote a script that gives me a log each week with a download/upload speed.

The script has 2 files:
1. the FTP script
2. the CMD file

Instructions:
- name the ftp script transfer.txt
- replace the [] in transfer.txt with your info
- create a file for transfer and save it as c:\temp\TestFile.dat. (I used Lan Speed Test)
- You can edit the script to fit your environment

CMD file:
===========================================
echo off

rem *** create a unique log file by date ***
Set MONTH=%DATE:~4,2%
Set DAY=%DATE:~7,2%
Set YEAR=%DATE:~10,4%
set output=%YEAR%-%MONTH%-%DAY%.txt

echo The test was performed on the %DATE% at %TIME% > %output%
echo. >> %output%

rem *** run the test ***
ftp -s:Transfer.txt > ftp_output.txt

rem *** extract the important lines from the log ***
for /f "tokens=1,2,3,4,5,6,7 delims= " %%A in (ftp_output.txt) do (
if "%%A"=="ftp:" (echo %%A %%D %%G >> %output%)
)
====================================================
after you have the file you can mail it or just archive it.

Transfer.txt (replace the [] with your info):
====================================================
open [your.ftp.server]
[Username]
[password]
put c:\temp\TestFile.dat TestFile.dat
get TestFile.dat c:\temp\TestFile.dat
quit
====================================================

the log file would look like this:
====================================================
The test was performed on the Tue 07/06/2010 at 11:30:10.78

ftp: received 2780.83Kbytes/sec.

ftp: sent 1874.44Kbytes/sec.
====================================================

Bye...

8 comments:

  1. Yes its very simple to checkout the internet speed. I checkout my internet speed from here http://www.ip-details.com/internet-speed-test/ @ free of costs.. Also in here we can get Ip address details...

    ReplyDelete
  2. yes, but the idea is to do it as a automatic script to run once every x time...

    ReplyDelete
  3. Getting the following at the end of the ftp output file. Any advice in tweaking it to get the speed in the file?
    win7 if it matters

    226 Transfer complete.
    ftp: 1048576 bytes received in Seconds Kbytes/sec.
    ftp> 37.3428.08quit
    221 Goodbye.

    ReplyDelete
  4. yes, I know.
    MS changed the ftp command line output so my script does not work (for some reason they removed the speed outcome).

    will work on 2003/XP...

    ReplyDelete
  5. If I run it with the output going to the screen it works. If I redirect to a file it puts both numbers together on the next line run together. So something in the redirect moves those dynamic values.

    Maybe I can do something with Python or Tcl to reproduce what you did here in a way that works on Win7.

    Thanks for putting it up, it is helpful

    ReplyDelete
  6. Nice information and the users replies and very informative please keep it up.

    ReplyDelete
  7. Great post. this is really good and very useful post. i was in search for post like this.

    ReplyDelete
  8. Very informative post! There is a lot of information here that can help any business get started with a successful social networking campaign. Ptcl broadband speed test

    ReplyDelete