1. Speedtest-cli
Github主页:https://github.com/sivel/speedtest-cli
2. 安装python-pip
yum install python-pip
3. 安装 speedtest-cli
pip install speedtest-cli
4. 根据距离排序列出周边的服务点
speedtest-cli –list
[root@master soft]# speedtest-cli --list
Retrieving speedtest.net configuration...
4863) Xi'an branch,Chinaunicom (Xi'an, China) [2.81 km]
29105) 陕西移动5G (Xi'an, China) [2.81 km]
26331) Henan CMCC 5G (Zhengzhou, China) [433.66 km]
36646) China Unicom HeNan 5G (Zhengzhou, China) [433.66 km]
34035) 安徽移动5G-HN (HuaiNai, China) [443.16 km]
16145) Lanzhou,China Mobile,Gansu (Lanzhou, China) [506.27 km]
37594) ChinaUnicom GanSu (Lanzhou, China) [506.27 km]
3973) China Telecom (Lanzhou, China) [506.27 km]
26501) shanxi CMCC 5G (Taiyuan, China) [517.21 km]
26940) ChinaMobile,Ningxia (Yinchuan, China) [528.45 km]
......
5. 简单测试
speedtest-cli –simple
[root@master soft]# speedtest-cli --simple
Ping: 39.955 ms
Download: 52.04 Mbit/s
Upload: 8.51 Mbit/s
6. 生成并分享测试结果图片
speedtest-cli –share
[root@master soft]# speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from China Telecom (1.83.234.131)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Henan CMCC 5G (Zhengzhou) [433.66 km]: 38.096 ms
Testing download speed...............................................................................
.Download: 59.11 Mbit/s
Testing upload speed................................................................................................
Upload: 8.92 Mbit/s
Share results: http://www.speedtest.net/result/10487765000.png
7. 完整用法
[root@master soft]# speedtest-cli -h
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes]
[--share] [--simple] [--csv]
[--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
[--list] [--server SERVER] [--exclude EXCLUDE]
[--mini MINI] [--source SOURCE] [--timeout TIMEOUT]
[--secure] [--no-pre-allocate] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
optional arguments:
-h, --help show this help message and exit
--no-download Do not perform download test
--no-upload Do not perform upload test
--single Only use a single connection instead of multiple. This
simulates a typical file transfer.
--bytes Display values in bytes instead of bits. Does not
affect the image generated by --share, nor output from
--json or --csv
--share Generate and provide a URL to the speedtest.net share
results image, not displayed with --csv
--simple Suppress verbose output, only show basic information
--csv Suppress verbose output, only show basic information
in CSV format. Speeds listed in bit/s and not affected
by --bytes
--csv-delimiter CSV_DELIMITER
Single character delimiter to use in CSV output.
Default ","
--csv-header Print CSV headers
--json Suppress verbose output, only show basic information
in JSON format. Speeds listed in bit/s and not
affected by --bytes
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against. Can be supplied
multiple times
--exclude EXCLUDE Exclude a server from selection. Can be supplied
multiple times
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with
speedtest.net operated servers
--no-pre-allocate Do not pre allocate upload data. Pre allocation is
enabled by default to improve upload performance. To
support systems with insufficient memory, use this
option to avoid a MemoryError
--version Show the version number and exit