arevindh / pihole-speedtest

Pihole Speedtest Mod
https://arevindh.github.io/pihole-speedtest/
MIT License
218 stars 22 forks source link

Speedtest scheduled update no longer working #83

Closed ChrisWNY closed 3 years ago

ChrisWNY commented 3 years ago

Since updating the Speedtest module, the scheduler no longer works.

When running the following command: sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh"

The result is as follows (appears to be related to deprecated args being passed to speedtest):

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] speedtest: error: unrecognized arguments: -s 15197 --accept-gdpr --accept-license -f json-pretty 2021-05-13 00:24:55 2021-05-13 00:24:57 0
Error: near ",": syntax error

Running the "speedtest" command by itself within the command line works fine, so does "pihole -a -sn" - that is also working, and the speedtest graph is updated properly. The script speedtest-official.sh however appears to be broken. Looks like the arguments/parameters for the speedtest-cli module have completely changed (version 2.1.3).

arevindh commented 3 years ago

May I know why are you still using python speedtest ?

ChrisWNY commented 3 years ago

I'm using the Official-CLI Speedtest which is installed and running on my Raspberry Pi 4b. I have "official CLI" chosen in settings.

Screenshot_20210513-094358_Chrome

arevindh commented 3 years ago

I think you have python version also installed

try speedtest-cli -h

You have to uninstall it to get the official CLI working

ChrisWNY commented 3 years ago

I get this as the output - arguments still seem to have changed in the speedtest-CLI...

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

arevindh commented 3 years ago

It's speedtest python version please uninstall it and try again . See any of the below work.

sudo pip3 uninstall speedtest-cli

OR

sudo pip uninstall speedtest-cli

OR

sudo apt-get remove speedtest-cli

ChrisWNY commented 3 years ago

Ok, it's uninstalled - how do I go about installing the non-python CLI? On the Speedtest-CLI github page, all the install directions seem to point toward installing the Python version. Thanks for helping out! After uninstalling, speedtest and speedtest-cli commands are now gone.

arevindh commented 3 years ago

Check here : https://www.speedtest.net/apps/cli

ChrisWNY commented 3 years ago

So I've tried that one recently...I get an error stating that the distribution version is not supported when trying to install on Raspberry Pi...sends me into a loop because https://www.speedtest.net/apps/cli points to the install command that is failing below...

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

arevindh commented 3 years ago

Output of uname -a

ChrisWNY commented 3 years ago

Linux raspberrypi 5.10.17-v7l+ #1414 SMP Fri Apr 30 13:20:47 BST 2021 armv7l GNU/Linux

arevindh commented 3 years ago

Try this

wget https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-armhf-linux.tgz
tar -xvzf  ookla-speedtest-1.0.0-armhf-linux.tgz
chmod +x speedtest
sudo mv speedtest /usr/local/bin
ChrisWNY commented 3 years ago

I downloaded and installed the binary, thanks for the instructions!

Still getting this odd error when running speedtest-official.sh...

sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" Testing with 15197 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] speedtest: error: unrecognized arguments: -s 15197 --accept-gdpr --accept-license -f json-pretty 2021-05-13 10:31:48 2021-05-13 10:31:48 0
Error: near ",": syntax error

ChrisWNY commented 3 years ago

Output of speedtest-h however looks good now (args line up with your script)...

speedtest -h Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.

Version: speedtest 1.0.0.2

Usage: speedtest [] -h, --help Print usage information -V, --version Print version number -L, --servers List nearest servers -s, --server-id=# Specify a server from the server list using its id -I, --interface=ARG Attempt to bind to the specified interface when connecting to servers -i, --ip=ARG Attempt to bind to the specified IP address when connecting to servers -o, --host=ARG Specify a server, from the server list, using its host's fully qualified domain name -p, --progress=yes|no Enable or disable progress bar (Note: only available for 'human-readable' or 'json' and defaults to yes when interactive) -P, --precision=# Number of decimals to use (0-8, default=2) -f, --format=ARG Output format (see below for valid formats) -u, --unit[=ARG] Output unit for displaying speeds (Note: this is only applicable for ‘human-readable’ output format and the default unit is Mbps) -a Shortcut for [-u auto-decimal-bits] -A Shortcut for [-u auto-decimal-bytes] -b Shortcut for [-u auto-binary-bits] -B Shortcut for [-u auto-binary-bytes] --selection-details Show server selection details --ca-certificate=ARG CA Certificate bundle path -v Logging verbosity. Specify multiple times for higher verbosity --output-header Show output header for CSV and TSV formats

Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty

Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision

Valid units for [-u] flag: Decimal prefix, bits per second: bps, kbps, Mbps, Gbps Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s Binary prefix, bits per second: kibps, Mibps, Gibps Binary prefix, bytes per second: kiB/s, MiB/s, GiB/s Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes

ChrisWNY commented 3 years ago

I see why...the script points to /usr/bin/speedtest for the binaries, so I also moved a copy of the speedtest binaries to /usr/bin

Seems to work now...will see if the scheduler kicks off normally at 12pm EST. Thanks!

town3r commented 3 years ago

With the EOL of bintray it's looking like they're going to want us to migrate to their new version. I got the same error when attempting the curl command.

Hopefully they update their install script to include raspberry pi flavors of linux.

I'm curious, what would happen if you don't run the curl command and only sudo apt install speedtest

New install instructions from https://www.speedtest.net/apps/cli#ubuntu

If migrating from prior bintray install instructions please first... sudo rm /etc/apt/sources.list.d/speedtest.list sudo apt-get update sudo apt-get remove speedtest

Other non-official binaries will conflict with Speedtest CLI Example how to remove using apt-get sudo apt-get remove speedtest-cli

curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash sudo apt-get install speedtest

ChrisWNY commented 3 years ago

From my experience it installs the Python version of speedtest when trying to install through the package manager. Recent updates to the Raspberry Pi OS seem to have broken some things. The manual method definitely works though.

arevindh commented 3 years ago

From my experience it installs the Python version of speedtest when trying to install through the package manager. Recent updates to the Raspberry Pi OS seem to have broken some things. The manual method definitely works though.

No, they won't install python version which is made my 3rd party

Please post the output of whereis speedtest

before and after the following commands

sudo pip3 uninstall speedtest-cli

sudo pip uninstall speedtest-cli

sudo apt-get remove speedtest-cli
ChrisWNY commented 3 years ago

whereis speedtest speedtest: /usr/bin/speedtest /usr/local/bin/speedtest /usr/share/man/man1/speedtest.1.gz

arevindh commented 3 years ago

@ChrisWNY Is the schedukled test working now ?

ChrisWNY commented 3 years ago

Yes! Worked great. No issues now. Manual binary install of Speedtest did the job. Thanks again for helping out!

ChrisWNY commented 3 years ago

Closing since this one is resolved.