需要python2.4-3.3支持。
github项目地址:https://github.com/sivel/speedtest-cli
安装方法有很多种:
1、pip / easy_install
pip install speedtest-cli
or
easy_install speedtest-cli
2、Github
pip install git+https://github.com/sivel/speedtest-cli.git
or
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install
3、Just download (Like the way it used to be)
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
or
curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
下载后添加可执行权限,直接执行命令
会查找距离最近的speedtest.net服务器,并打印出你服务器当前的下行和上行带宽。
[root@localhost ~]# ./speedtest-cli
Retrieving speedtest.net configuration...
Testing from China Telecom Guangdong (183.62.174.54)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by ShenZhen Telecom (Shenzhen) [0.00 km]: 1118.768 ms
Testing download speed................................................................................
Download: 4.65 Mbit/s
Testing upload speed................................................................................................
Upload: 9.15 Mbit/s
使用--share 参数,会将测试结果上传到speedtest.net 服务器并以图形方式展示。通过链接地址获得图形报告,如下图。
[root@localhost ~]# ./speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from China Telecom Guangdong (183.62.174.54)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by 75510010 (ShenZhen) [0.00 km]: 2552.787 ms
Testing download speed................................................................................
Download: 2.43 Mbit/s
Testing upload speed................................................................................................
Upload: 2.31 Mbit/s
Share results: http://www.speedtest.net/result/7253182155.png
使用./speedtest-cli -h 获得使用帮助
原文地址:http://blog.51cto.com/mofansheng/2107189