Wouldn’t it be nice to be able to test your upload/download speed from your VPS and share the “famous” picture from speedtest.net ?
Speedtest.net uses Flash to test upload/download speed which is a hassle on most VPS.
The long way to get this is to install VNC and run it from a browser, but that is no longer necessary.
We can now useย Matt Martz python script speedtest-cli to accomplish this from the commandline.
Prerequisites:
- Pythonย 2.4-2.7 or 3
After you have installed Python on your vps download the speedtest-cli file from github.
1 |
wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py |
when the download is complete, make the file executable with:
1 |
chmod +x speedtest-cli |
and then run it with:
1 |
./speedtest-cli.py --share |
after the test are run you will get the url to your speedtest.net image.
heres an example ran from a Securedragon VPS
1 2 3 4 5 6 7 8 9 10 11 |
root@sdragon256:~# python speedtest-cli --share Retrieving speedtest.net configuration... Retrieving speedtest.net server list... Testing from Secure Dragon LLC. (199.167.31.XXX)... Selecting best server based on ping... Hosted by Hivelocity Hosting (Tampa, FL) [27.12 km]: 56.982 ms Testing download speed........................................ Download: 78.07 Mbit/s Testing upload speed.................................................. Upload: 58.69 Mbit/s Share results: http://www.speedtest.net/result/2481742413.png |
Thanks for the post – very helpful!
Just tried on my amazon e3 micro
http://www.speedtest.net/result/2535062237.png
An FtpIt VPS surely can beat Amazon then. ๐
Colocrossing 696 Mb/s o_O
http://www.speedtest.net/result/2533328874.png
how to choose a server location? @_@
u might nid to edit the script in order to do so
idk how btw, idk about python ~
No, Colocrossing is fast: http://www.speedtest.net/result/3211891986.png
i just look into the script
“parser.add_argument(‘–server’, help=’Specify a server ID to test against’)”
the script alrd well written to be modifiable
serverlist : http://speedtest.net/speedtest-servers.php
just go through the script and u will find a lot more that can customize
I just notice this
Options:
-h, –help show this help message and exit
–share Generate and provide a URL to the speedtest.net share
results image
–simple Suppress verbose output, only show basic information
–list Display a list of speedtest.net servers sorted by distance
–server=SERVER Specify a server ID to test against
lovely script btw ~
tested on one of my frantech vps
http://www.speedtest.net/result/2538158963.png
I used to do that VNC thing… Not anymore! Thanks for the info.. When I first tried I got this http://pastebin.com/Lm4kA7eu
I moved to a different VPS and it worked perfectly.
http://www.speedtest.net/result/2544318087.png (RamNode)
Here is another one after Linode upgraded their network resources:
Download is freaking awesome.
just tested your tutorial. nice
http://www.speedtest.net/result/2576952696.png | Ramnode
My speedtest on a Colocrossing vps http://www.speedtest.net/result/2616958871.png
Good download speed. Where do you have your server?
My speedtest using SecuredSpeed.com VPS: http://www.speedtest.net/result/2705460994.png
Looks like securedSpeed.com is based out of OC3 Networks/Quadranet…
http://www.speedtest.net/result/2721853078.png
Nice!
Which host :O
using securedspeed
http://www.speedtest.net/result/2802257749.png
[root@ns1 ~]# wget https://raw.github.com/sivel/speedtest-cli/master/speedtest-cli-3 –no-check-certificate -O speedtest-cli.py
–2013-09-24 14:28:20– https://raw.github.com/sivel/speedtest-cli/master/speedtest-cli-3
Resolving raw.github.com… 199.27.72.133
Connecting to raw.github.com|199.27.72.133|:443… connected.
HTTP request sent, awaiting response… 404 Not Found
2013-09-24 14:28:21 ERROR 404: Not Found.
you should update your links…
wget https://github.com/sivel/speedtest-cli/blob/master –no-check-certificate -O speedtest-cli.py
new link is https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
I will update the original post.
Thanks for mentioning.
FreeBSD9.1, Python 2.7:
root@timeisall:/home/*** # ./speedtest-cli.py –share
Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from ISPsystem, cjsc (188.120.229.149)…
Selecting best server based on ping…
Traceback (most recent call last):
File “./speedtest-cli.py”, line 549, in
main()
File “./speedtest-cli.py”, line 543, in main
speedtest()
File “./speedtest-cli.py”, line 465, in speedtest
best = getBestServer(servers)
File “./speedtest-cli.py”, line 326, in getBestServer
uh = urlopen(‘%s/latency.txt’ % url)
File “/usr/local/lib/python2.7/urllib2.py”, line 127, in urlopen
return _opener.open(url, data, timeout)
File “/usr/local/lib/python2.7/urllib2.py”, line 404, in open
response = self._open(req, data)
File “/usr/local/lib/python2.7/urllib2.py”, line 422, in _open
‘_open’, req)
File “/usr/local/lib/python2.7/urllib2.py”, line 382, in _call_chain
result = func(*args)
File “/usr/local/lib/python2.7/urllib2.py”, line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “/usr/local/lib/python2.7/urllib2.py”, line 1184, in do_open
raise URLError(err)
urllib2.URLError:
./speedtest-cli.py –server 2061
Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from ISPsystem, cjsc (188.120.229.149)…
Traceback (most recent call last):
File “./speedtest-cli.py”, line 549, in
main()
File “./speedtest-cli.py”, line 543, in main
speedtest()
File “./speedtest-cli.py”, line 427, in speedtest
servers))
File “./speedtest-cli.py”, line 326, in getBestServer
uh = urlopen(‘%s/latency.txt’ % url)
File “/usr/local/lib/python2.7/urllib2.py”, line 127, in urlopen
return _opener.open(url, data, timeout)
File “/usr/local/lib/python2.7/urllib2.py”, line 404, in open
response = self._open(req, data)
File “/usr/local/lib/python2.7/urllib2.py”, line 422, in _open
‘_open’, req)
File “/usr/local/lib/python2.7/urllib2.py”, line 382, in _call_chain
result = func(*args)
File “/usr/local/lib/python2.7/urllib2.py”, line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File “/usr/local/lib/python2.7/urllib2.py”, line 1184, in do_open
raise URLError(err)
urllib2.URLError: urlopen error [Errno 8] hostname nor servname provided, or not known
Sorry for false alarm. The problem is not in the script. It seems that my ip is banned with some of speedtest servers from the list.
just test it on 1gb/s but only 500 mb and upload bad
http://www.speedtest.net/result/3092380632.png
http://www.speedtest.net/result/3106947223.png ๐
http://www.speedtest.net/result/3126508507.png
Here we go… http://www.speedtest.net/result/3132340957.png
Easiest way to do this is by following this guide http://vpstip.com/how-to-speed-test-vps-in-linux/
Interesting, exactly the same thing I wrote but in other words and another provider used for the example.
Nice to see that people find it useful.
http://www.speedtest.net/result/3199168807.png
My upload is slow,,,,
I would say it’s good enough. ๐
Its say no file or directory if i run with ./speedtest-cli.py –share
But solved with removing the extention .py
http://www.speedtest.net/result/3224206882.png
I guess you got the first command wrong and saved your file without the .py extension
FranTech http://www.speedtest.net/result/3252880086.png
http://www.speedtest.net/result/3329251625.png
๐
http://www.speedtest.net/result/3356941230.png
http://www.speedtest.net/result/3661672320.png – AIMVM
http://www.speedtest.net/result/3827361639.png
time to start VPN hosting ๐
How to do the same ping for ipv6?
Speedtest.net do not support ipv6 yet. https://support.speedtest.net/hc/en-us/articles/203845430-Does-Speedtest-net-support-IPv6-
http://www.speedtest.net/result/4093304254.png
Mine is also too fast. ๐
wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
–2015-03-18 04:13:22– https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
Resolving raw.github.com… 23.235.46.133
Connecting to raw.github.com|23.235.46.133|:443… connected.
ERROR: certificate common name
www.github.com' doesn't match requested host name
raw.github.com’.To connect to raw.github.com insecurely, use `–no-check-certificate’.
what’s wrong?
Try this:
wget โno-check-certificate -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
wget gets redirected and the certificate is not correct for the site that you are redirected to.
This post is worth everyone’s attention. Where can I
find out more?
If you do not have python in OS:
Another way to test the speed at Speedtest.net servers from Linux CLI (without python) :
http://www.sysadmit.com/2015/04/linux-speedtestnet-cli.html
I love what you guys are up too. Such clever work and coverage!
Keep up the amazing works guys I’ve incorporated you guys to blogroll.
https://www.speedtest.net/result/4574384954.png