arevindh / pihole-speedtest

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

CLI #54

Closed flipptx closed 3 years ago

flipptx commented 3 years ago

switched over to CLI but have problems when i run... sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh"

i get the following.. Testing with usage: speedtest [-h] [--bytes] [--share] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json] [--list] [--server SERVER] [--mini MINI] [--source SOURCE] [--timeout TIMEOUT] [--secure] [--version] speedtest: error: unrecognized arguments: --accept-gdpr --accept-license -f json-pretty ERROR: 2

if a run speedtest-cli it works

and speedtest works too

flipptx commented 3 years ago

side note any chance of a "run now" button from the web interface?

arevindh commented 3 years ago

@flipptx Try uninstalling python version. Will try add run now button with next update

P4RI4H commented 3 years ago

@arevindh Having the same issue as @flipptx. How would one uninstall the python version? (I'm only a casual user.) Thanks!

@91ajames Looks like you need to install speedtest-cli EDIT: deleted line regarding installing speedtest-cli as better info is given by arevindh

flipptx commented 3 years ago

@P4RI4H sorry I've been on the road so i cant confirm yet, if this is the fix. I'll take a look when i fly back later this week

arevindh commented 3 years ago

@P4RI4H @flipptx python version is inaccurate, uninstall it and install the official version

Install guide

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

To uninstall sudo pip uninstall speedtest-cli should work

Don't forget to change it in the web interface

Rafael44p commented 3 years ago

@arevindh I'm having a simular problem and i don't know where from, i'm using an vm.

speedtest: error: unrecognized arguments: --accept-gdpr --accept-license -f json-pretty
2020-10-01 15:05:00     2020-10-01 15:05:00                             0
Error: near ",": syntax error
arevindh commented 3 years ago

@P4RI4H @flipptx python version is inaccurate, uninstall it and install the official version

Install guide

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

To uninstall sudo pip uninstall speedtest-cli should work

Don't forget to change it in the web interface

@Rafael44p use this to uninstall the python version and install the official CLI

Rafael44p commented 3 years ago

@P4RI4H @flipptx python version is inaccurate, uninstall it and install the official version

Install guide

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

To uninstall sudo pip uninstall speedtest-cli should work

Don't forget to change it in the web interface

@Rafael44p use this to uninstall the python version and install the official CLI

@arevindh pip command is not found, and I have installed the official speedtest-cli. Both speedtest and speedtest -cli work in shell but not in the pihole interface

arevindh commented 3 years ago

@Rafael44p which os are your running on? Can you post the output of whereis speedtest

Rafael44p commented 3 years ago

@arevindh

Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-48-generic x86_64)

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

arevindh commented 3 years ago

@Rafael44p Seems something changed on speedtest . Can you post output of speedtest --help

Rafael44p commented 3 years ago

@arevindh

speedtest --help
usage: speedtest [-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

@Rafael44p its python speedtest . You have to uninstall this.

Rafael44p commented 3 years ago

@arevindh ok, but how do you unistall something that says it's not installed?

arevindh commented 3 years ago

@Rafael44p try sudo pip3 uninstall speedtest-cli OR sudo pip uninstall speedtest-cli OR sudo apt-get remove speedtest-cli

arevindh commented 3 years ago

@arevindh ok, but how do you unistall something that says it's not installed?

Its installed somehow. Need to remove it for the rest to work.

Check https://github.com/sivel/speedtest-cli , there are multiple ways to install it .

Rafael44p commented 3 years ago

@arevindh The last one did it for me and now?

Thx for being patient, I'm still figuring out linux commands there are so many ways you can change things.

arevindh commented 3 years ago

@Rafael44p

sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
# Ubuntu versions supported: xenial, bionic
# Debian versions supported: jessie, stretch, buster
export DEB_DISTRO=$(lsb_release -sc)
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo "deb https://ookla.bintray.com/debian ${DEB_DISTRO} main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
sudo apt-get install speedtest

Source : https://www.speedtest.net/apps/cli

Rafael44p commented 3 years ago

@arevindh

sudo apt-get update
Hit:1 http://pt.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://pt.archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Get:3 http://pt.archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:4 http://pt.archive.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Ign:5 https://ookla.bintray.com/debian focal InRelease
Err:6 https://ookla.bintray.com/debian focal Release
  404  Not Found [IP: 52.28.44.12 443]
Get:7 http://pt.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [557 kB]
Get:8 http://pt.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [143 kB]
Get:9 http://pt.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [243 kB]
Get:10 http://pt.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [93.8 kB]
Reading package lists... Done
E: The repository 'https://ookla.bintray.com/debian focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Is this normal? because i can't install speedtest because it's unable to locate package "speedtest".

arevindh commented 3 years ago

@Rafael44p

Only Ubuntu 16.04/18.04 are supported as per their documentation

Anyway try edit /etc/apt/sources.list.d/speedtest.list and change focal to bionic then try

sudo apt-get update
sudo apt-get install speedtest
Rafael44p commented 3 years ago

@arevindh

That did the trick i suppose. Checked pihole and used sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" immediately showed 1 result.

you might want to add this solution for everyone that's trying installing this on focal.

Thanks allot

91ajames commented 3 years ago

Had this working roughly a yr ago, and hadn't had time to comment back. Have the same problem as you @Rafael44p as @arevindh suggested. works running throu the speedtest cmd but nothing is kept in pihole. No isp, no speeds, just blanks.

And if your mentioning the change of the servers. yea, I have had that problem saying

root@tinkerboard:/# sudo /var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh
Testing with SERVER###
usage: speedtest [-h] [--bytes] [--share] [--simple] [--csv]
                 [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
                 [--list] [--server SERVER] [--mini MINI] [--source SOURCE]
                 [--timeout TIMEOUT] [--secure] [--version]
speedtest: error: unrecognized arguments: -s SERVER### --accept-gdpr --accept-license -f json-pretty
ERROR: 2

Does the same if i changed pihole to blank. but in this case, no number is shown. Testing with

But running it like this speedtest --server #### works but nothing gets added to pihole chart except zero's and the time of day. image

Adding the source, errors out, the list contains this, deb https://ookla.bintray.com/debian main

Of course im not on ubunto but mentions of changes focal to bionic, I just a bit lost there since there's nothing like that in the list.

arevindh commented 3 years ago

@91ajames You are still using speedtest-cli python. You need to uninstall it .

Then install official CLI

91ajames commented 3 years ago

@arevindh yea, i guess its not so supported on my end. Even installed the deb file manually. and yes, i have uninstalled the python in the past and have done it now.

sudo apt install ookla-speedtest-1.0.0-armhf-linux.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ookla-speedtest-1.0.0-armhf-linux.deb
E: Couldn't find any package by glob 'ookla-speedtest-1.0.0-armhf-linux.deb'
E: Couldn't find any package by regex 'ookla-speedtest-1.0.0-armhf-linux.deb'
arevindh commented 3 years ago

@arevindh yea, i guess its not so supported on my end. Even installed the deb file manually. and yes, i have uninstalled the python in the past and have done it now.

sudo apt install ookla-speedtest-1.0.0-armhf-linux.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ookla-speedtest-1.0.0-armhf-linux.deb
E: Couldn't find any package by glob 'ookla-speedtest-1.0.0-armhf-linux.deb'
E: Couldn't find any package by regex 'ookla-speedtest-1.0.0-armhf-linux.deb'

Which is your device and OS ?

91ajames commented 3 years ago

@arevindh Which is your device and OS ?

Sry for not replying back, did not pop in my notifications. Asus TinkerBoard / TinkerOS - which is debian armfh

Worked in the past but that was long ago. Maybe somehow update it without python (or the latest python ver. this setup could be supported) so it could support others that would show up in the graph once again in case Speedtest.net doesn't work for others.

in the past, your install scrypt, in settings, there's the Official CLI and there's Python, I've always kept it with the Official CLI and worked, and no longer, wounder what changed.

cronus130 commented 3 years ago

Any update on this? Would love to get the “official” Speedtest working as an option as the python version (speedtest-cli) does not report results accurately with 300Mb/s or higher.

I test installed this version which is working, with accurate results on my Raspberry Pi 4 (when run as a stand alone command “speedtest”):

sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo "deb https://ookla.bintray.com/debian generic main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
# Other non-official binaries will conflict with Speedtest CLI
# Example how to remove using apt-get
# sudo apt-get remove speedtest-cli
sudo apt-get install speedtest

Source : https://www.speedtest.net/apps/cli

arevindh commented 3 years ago

Any update on this? Would love to get the “official” Speedtest working as an option as the python version (speedtest-cli) does not report results accurately with 300Mb/s or higher.

I test installed this version which is working, with accurate results on my Raspberry Pi 4 (when run as a stand alone command “speedtest”):

sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo "deb https://ookla.bintray.com/debian generic main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
# Other non-official binaries will conflict with Speedtest CLI
# Example how to remove using apt-get
# sudo apt-get remove speedtest-cli
sudo apt-get install speedtest

Source : https://www.speedtest.net/apps/cli

It is already a part of this mod since June 4 2020 .

https://github.com/arevindh/pihole-speedtest/blob/master/README.md