arevindh / pihole-speedtest

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

Option to use official Speedtest CLI client #40

Closed andrewmooreio closed 4 years ago

andrewmooreio commented 4 years ago

First off, thank you for the great work on this!

Ookla have now released an official Speedtest CLI client written in C++, with official support for macOS, Ubuntu/Debian, Fedora/CentOS/Red Hat and FreeBSD.

Blog post here.

From my testing it is much more performant than the Python based speedtest-cli currently used in pihole-speedtest. See below for the comparisons testing to the same server from the same client.

Python speedtest-cli results:

$ speedtest-cli --server 2789 Retrieving speedtest.net configuration... Testing from Virgin Media... Retrieving speedtest.net server list... Retrieving information for the selected server... Hosted by Vodafone UK (Acton) [7.24 km]: 21.048 ms Testing download speed................................................................................ Download: 221.29 Mbit/s Testing upload speed................................................................................................ Upload: 35.83 Mbit/s

Official Speedtest CLI results:

$ speedtest -s 2789

Speedtest by Ookla

Server: Vodafone UK - Acton (id = 2789) ISP: Virgin Media Latency: 9.04 ms (4.38 ms jitter) Download: 384.48 Mbps (data used: 524.1 MB) Upload: 36.46 Mbps (data used: 32.3 MB) Packet Loss: Not available.

I have repeated these tests many times, from different clients to different servers and the results are always consistent. I have also tested using iPerf3 to an AWS instance, and the results matched that of the official Speedtest CLI client. The Python based speedtest-cli results are invalid.

This has been raised with the maintaner of speedtest-cli, examples here and here. However, he just closes the issue and deletes any comments offering constructive criticism.

I appreciate that the official Speedtest CLI client isn't FOSS but it would be great to at least have the option to use the official client which gives reliable results.

Regards.

arevindh commented 4 years ago

It's good to see they are providing such functionality now. Let me try to integrate it, not sure how successful it will be. Will update you once I try it.

arevindh commented 4 years ago

@andrewrmoore . Seems like it might me easier to integrate than existing python variant, but need more changes in code. I am working on it when I have free time, should take a week or two.

arevindh commented 4 years ago

@andrewrmoore Made a working version with official speedtest-cli, can you try it out before its released ?

andrewmooreio commented 4 years ago

@arevindh Amazing, thank you. I'm more than happy to test it out.

arevindh commented 4 years ago
sudo su

cd /opt/pihole/
mv webpage.sh webpage.sh.master
wget https://github.com/arevindh/pi-hole/raw/master/advanced/Scripts/webpage.sh
chmod +x webpage.sh

cd /var/www/html/admin git remote -v

Make sure that remote is

origin https://github.com/arevindh/AdminLTE (fetch) origin https://github.com/arevindh/AdminLTE (push)

cd /var/www/html/admin
git checkout dev
git pull

Go to Pihole settings and set Official CLI as speed-test mode.

Try running

sudo /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh And check front end for updates

andrewmooreio commented 4 years ago

I have followed your instructions and have a few pieces of feedback. All-in-all, amazing! The results are now accurate for the mostpart.

Issue 1:

[andrew@pihole01 speedtest]$ sudo /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh
Testing with 2789
==============================================================================

Ookla collects certain data through Speedtest that may be considered
personally identifiable, such as your IP address, unique device
identifiers or location. Ookla believes it has a legitimate interest
to share this data with internet providers, hardware manufacturers and
industry regulators to help them understand and create a better and
faster internet. For further information including how the data may be
shared, where the data may be transferred and Ookla's contact details,
please see our Privacy Policy at:

       http://www.speedtest.net/privacy

==============================================================================

To accept the message please run speedtest interactively or use the following:

    speedtest --accept-gdpr
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 22: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 23: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 24: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 25: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 26: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 27: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 28: jq: command not found
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh: line 29: jq: command not found
2020-06-03 16:33:55     2020-06-03 16:33:55                             0
Error: near ",": syntax error

Resolution: Install jq, I'm on CentOS so sudo yum install jq -y, the package was provided from the EPEL repo. Please be sure that this is noted as a dependency when pushed to master.

Issue 2:

[andrew@pihole01 speedtest]$ sudo /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh
Testing with 2789
==============================================================================

Ookla collects certain data through Speedtest that may be considered
personally identifiable, such as your IP address, unique device
identifiers or location. Ookla believes it has a legitimate interest
to share this data with internet providers, hardware manufacturers and
industry regulators to help them understand and create a better and
faster internet. For further information including how the data may be
shared, where the data may be transferred and Ookla's contact details,
please see our Privacy Policy at:

       http://www.speedtest.net/privacy

==============================================================================

To accept the message please run speedtest interactively or use the following:

    speedtest --accept-gdpr
2020-06-03 16:34:29     2020-06-03 16:34:29                             0
Error: near ",": syntax error

Resolution: Run sudo speedtest --accept-gdpr manually and the following notice is displayed. License acceptance recorded. Continuing. Subsequent runs will not have the issue (this may be an EU only thing due to GDPR).

Issue 3:

Result is missing Distance data: Annotation 2020-06-03 165022

Issue 4:

Result shown in Speedtest table within the UI doesn't quite match the actual result: Annotation 2020-06-03 165022 Actual result: Annotation 2020-06-03 165349 Looks like you are using Mebibytes and Speedtest use Megabytes: Annotation 2020-06-03 165642

Please let me know if there's anything else you'd like me to test. Thanks a lot.

arevindh commented 4 years ago

Thank you @andrewrmoore.

  1. Added to documentation sudo apt install jq -y
  2. Added --accept-gdpr along with --accept-license
  3. Seems there is no distance parameter in the output json .
  4. Seems like I used 1024 instead of 1000. Fixed.

Can you pull and try again sudo /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh

andrewmooreio commented 4 years ago

The script now matches the unit (Mb/s) of Speedtest CLI.

Thanks so much @arevindh! Bought you a coffee :smile:

arevindh commented 4 years ago

@andrewrmoore Thanks a lot.

mgarland1988 commented 3 years ago

Results are far more accurate using the official Speedtest CLI client.

The only issue that I am still seeing is no distance date (Issue 3) Was there a fix for this, or is this still ongoing?

Thank you for all your hard work!

arevindh commented 3 years ago

Results are far more accurate using the official Speedtest CLI client.

The only issue that I am still seeing is no distance date (Issue 3) Was there a fix for this, or is this still ongoing?

Thank you for all your hard work!

The field will be removed soon since the official server does not provide distance info