speedtest したい
speedtest-cliがある。
https://www.speedtest.net/apps/cli
この中のdebian を実行してみる
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash This distribution version is not currently supported via package management, please use the direct download builds per architecture found at https://www.speedtest.net/apps/cli
どうやら Raspberry pi では apt を使うみたい
https://sbcguides.com/internet-speed-test-on-raspberry-pi/ sudo apt install speedtest-cli パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下のパッケージが新たにインストールされます: speedtest-cli アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。 23.4 kB のアーカイブを取得する必要があります。 この操作後に追加で 103 kB のディスク容量が消費されます。 エラー:1 http://raspbian.raspberrypi.org/raspbian buster/main armhf speedtest-cli all 2.0.2-1+deb10u1 404 Not Found [IP: 2a00:1098:0:80:1000:75:0:3 80] E: http://raspbian.raspberrypi.org/raspbian/pool/main/s/speedtest-cli/speedtest-cli_2.0.2-1+deb10u1_all.deb の取得に失敗しました 404 Not Found [IP: 2a00:1098:0:80:1000:75:0:3 80] E: いくつかのアーカイブを取得できません。apt-get update を実行するか --fix-missing オプションを付けて試してみてください。
こんな時は apt-get update してみる
sudo apt-get update 取得:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB] 取得:2 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB] 取得:3 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB] 取得:4 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages [58.7 kB] 取得:5 http://archive.raspberrypi.org/debian buster/main armhf Packages [378 kB] 取得:6 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages [104 kB] 13.6 MB を 11秒 で取得しました (1,294 kB/s) パッケージリストを読み込んでいます... 完了
もう一度 apt
sudo apt install speedtest-cli パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下のパッケージが新たにインストールされます: speedtest-cli アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 332 個。 23.4 kB のアーカイブを取得する必要があります。 この操作後に追加で 103 kB のディスク容量が消費されます。 取得:1 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf speedtest-cli all 2.0.2-1+deb10u2 [23.4 kB] 23.4 kB を 1秒 で取得しました (21.7 kB/s) 以前に未選択のパッケージ speedtest-cli を選択しています。 (データベースを読み込んでいます ... 現在 153744 個のファイルとディレクトリがインストールされています。) .../speedtest-cli_2.0.2-1+deb10u2_all.deb を展開する準備をしています ... speedtest-cli (2.0.2-1+deb10u2) を展開しています... speedtest-cli (2.0.2-1+deb10u2) を設定しています ... man-db (2.8.5-2) のトリガを処理しています ...
どうやらできたらしい。
speedtest 実行
speedtest Retrieving speedtest.net configuration... Testing from Chubu Telecommunications Company (14.132.216.75)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by OpenGW (Shizuoka) [171.85 km]: 19.634 ms Testing download speed................................................................................ Download: 107.17 Mbit/s Testing upload speed...................................................................................................... Upload: 159.41 Mbit/s
デキた模様
cron で CSV で出力
speedtest –csv
42842,Mamireimu Net Work's,Nara,2021-08-07T00:58:11.214741Z,65.80144571334749,22.898,32933450.97275489,66143858.64751526,,14.132.216.75
crontab 化
コマンドの位置 which speedtest /usr/bin/speedtest データ保存ディレクトリを作成 pwd /home/pi pi@raspberrypi:~ $ mkdir speedtest-csv ヘッダー作っとく speedtest --csv-header >> /home/pi/speedtest-csv/speedtest.csv crontabに登録 crontab -e */10 * * * * /usr/bin/speedtest --csv >> /home/pi/speedtest-csv/speedtest.csv
speedtest –help で使い方
usage: speedtest [-h] [--no-download] [--no-upload] [--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
--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
