CentOS7でコマンドラインからインターネット接続のスピードテストを行えるサービス「Speedtest-cli」
投稿日:2017年10月27日
最終更新日:
もくじ
- 「Speedtest-cli」の概要
- 「Speedtest-cli」の導入手順
- スピードテストのやり方
「Speedtest-cli」の概要
「Speedtest-cli」は、CentOSでコマンドラインから利用できるインターネット接続のスピードテストを行えるサービスです。世界各地に存在するテスト用サーバー群から自分のマシンに近いものがIPアドレスを元に自動選択され(自分で選ぶことも可能)、Pingの応答時間、ダウンロード速度及びアップロード速度が表示されます。これらの情報は画像で出力させることもできます。
「Speedtest-cli」の導入手順
まずはrootまたはsudoできるユーザーでCentOS7にログインし、以下のコマンドでpythonの「easy_install」を導入します。
1 |
sudo yum install python-setuptools |
easy_installを入れたら、以下のコマンドでSpeedtest-cliを導入します。
1 |
sudo easy_install speedtest-cli |
スピードテストのやり方
Speedtest-cliを導入した後、以下のコマンドを打てばスピードテストが始まります(root権限は不要)。
1 2 3 4 5 6 7 |
speedtest #結果表示を必要最小限に speedtest --simple #結果を画像に出力する(結果表示の最後に画像のURLが出て来る) speedtest --share |
テスト結果はこのように表示されます。
なお、Speedtest-cliではどのサーバーと接続してテストを行うかを選択できます。テストサーバーのリストは以下のコマンドで取り出すことができます。
1 2 3 4 |
speedtest --list #日本にあるテストサーバーだけを抜き出す speedtest --list | grep Japan |
2017年4月現在、日本にあるテストサーバーはだいたいこんな感じです。
実際にテストサーバーを指定してテストする場合は以下のコマンドを打ちます。
1 2 3 4 |
speedtest --server (サーバーID) #例 仙台のサーバー(サーバーID:8193)に接続してテストする場合 speedtest --server 8193 |
ヘルプは以下のコマンドで表示させることができます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
speedtest -h #2017年4月地点での情報 usage: speedtest [-h] [--no-download] [--no-upload] [--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 --no-download Do not perform download test --no-upload Do not perform upload test --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 --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 |