莫忘少年凌云志
曾许天下第一流

服务器上用speedtest-cli测速

一键方案

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py && chmod +x speedtest-cli && ./speedtest-cli --share

wget下载脚本

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

遇到脚本因为证书问题下载失败的

The certificate of ‘raw.githubusercontent.com’ is not trusted.

执行

apt-get install ca-certificates

给权限

chmod +x speedtest-cli

跑之前我们可以看看具体用法

[root@sd-75327 online]# ./speedtest-cli --help
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--csv]
                     [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
                     [--list] [--server SERVER] [--mini MINI]
                     [--source SOURCE] [--timeout TIMEOUT] [--secure]
                     [--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
  --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
  --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
  --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
  --version             Show the version number and exit

我要求挺低的,一般就带个–share参数,生成最后的测速结果图片。所以执行以下命令测速

./speedtest-cli --share

我们来看结果,G口的机器,不能跑满1000M略微不爽,拿来刷PT还是很够了。

[root@sd-75327 online]# ./speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from Online.net (195.154.164.48)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Orange (Paris) [13.66 km]: 3.222 ms
Testing download speed................................................................................
Download: 807.79 Mbit/s
Testing upload speed....................................................................................................
Upload: 450.26 Mbit/s
Share results: http://www.speedtest.net/result/5855011670.png

最后贴个测速图

哎哟不错

赞(1) 打赏
未经允许不得转载:面条的小博客 » 服务器上用speedtest-cli测速
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏