Coder Social home page Coder Social logo

pihole-speedtest's Introduction

Pi-hole Speedtest

Speedtest Chart

Join the chat at https://gitter.im/pihole-speedtest/community Discord Docker Build

This project is a few things, the major parts being a Pi-hole extension and a speedtest runner. Install the Speedtest Mod in a breeze with the one-liners and Docker images below.

The Runner

The Test Script is a standalone tool that can be used to run speedtests on automated Debian or Fedora based systems. It will install a speedtest CLI if one hasn't been, run a test, and save the results to a new or existing database. You can use it to test your connection, monitor your ISP, or check the speed of your VPN. Let us know how you're using it! See usage for details.

curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/test | sudo bash -s -- -o ~/speedtest.db

Please keep in mind that the more tests you run, the more data will be used, and any issues about weird results should be directed to the maintainers of whichever speedtest CLI is installed on your system, not here.

The Extension

The Mod allows you to use the Test Script and run speedtests right from the Pi-hole web UI! Install, set a testing interval and customize the chart in Settings, kick back, and watch the results come in on the Dashboard. Other features include:

  • Run tests ad-hoc
  • Export data as CSV
  • View status, logs, and servers
  • Flush or restore the database
  • Select speedtest server

Speedtest Settings

Installing

The Mod Script is our installation manager; it automates the process of applying our patches. It supports Debian, Fedora, and derivatives with and without systemd. Docker, too! You can use it to quickly try out the Mod and uninstall it if you don't like it. For information about running Pi-hole in Docker, including a Compose example, please refer to the official repo and docs. Post-install instructions are below.

Via the Shell

You can just pipe to bash:

curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod | sudo bash

With Docker

The above goes for Docker as well. We use the Dockerfile in this repo to build an image with the Mod Script already applied. Simply change the image you're using to ours and proceed as usual. It's a drop-in replacement.

ghcr.io/arevindh/pihole-speedtest:latest

You can also run the Mod Script inside every new container yourself. For example, if you're using Compose, by replacing the image line with:

build:
    dockerfile_inline: |
        FROM pihole/pihole:latest
        RUN curl -sSL https://github.com/arevindh/pihole-speedtest/raw/master/mod | sudo bash

Then pull and rebuild without cache:

docker compose pull; docker compose down; docker compose build --no-cache; docker compose up -d

Post Install

After installation, the Mod will use the Test Script to mediately install Ookla's official speedtest, unless you already have speedtest-cli or librespeed-cli installed as /usr/bin/speedtest. You can install and switch between all of these with the Mod Script's -s option. Please refer to our wiki to see how to use this option and what others are available. Should any of the CLI packages fail at runtime, the others will be tried.

Further Instructions: Updating | Uninstalling

Buy me a ☕️

Buy @arevindh a ☕️ if you like this project :)

Buy Me A Coffee

@ipitio is not accepting donations at this time, but a star is always appreciated!

pihole-speedtest's People

Contributors

arevindh avatar gitter-badger avatar ipitio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pihole-speedtest's Issues

Issue - Schedule Not Working

Not sure if this is the right spot, but the scheduler does not seem to work. I see the entry in crontab but it has not posted a run since configuring yesterday. I currently have the schedule set to hourly to see if that helps. Manual runs are fine and show in pihole. Let me know what data you need.

0 */1 * * * sudo "/var/www/html/admin/scripts/pi-hole/speedtest/speedtest-official.sh" > /dev/null 2>&1

image

From the below screenshot; these are all manual runs, no 'scheduled' runs are working:
image

Graphs not showing properly

Hi,

I just installed the speedtest you've implemented for pihole. It's working, saving and showing speedtests properly, but if I visit pi.hole/admin at the first place the "Total queries", "Client activity", "Query Types" and "Queries answered by" graphs aren't showing up to the point I hover over them with the mouse. The following picture was taken right after refreshing the pi.hole/admin page:

speedtestpihole

Somehow on the time axis, only one hour is shown at the first place. After hovering over the corresponding graph, it's correctly shown as usually (for the last 24 hours).

AdminLTE 5.0

What is the process of upgrading from 4.x to 5.0 adminLTE? PiHole -up does not upgrade adminLTE. Would the steps be:
Uninstall speed test mod, upgrade adminLTE, then install speed test mod again?
Thanks

Does not show graph display on dashboard. Console errors.

Pi-hole Version v4.1.1 Web Interface Version v4.1.1 FTL Version v4.1.2
Browsers: Chrome v71, Firefox Quantum v65

I initially thought this was a Chrome issue only, but I had the wrong debug window open.

Uncaught TypeError: Cannot read property 'length' of null at Object.acquireContext (Chart.bundle.min.js:10) at t.construct (Chart.bundle.min.js:10) at new t (Chart.bundle.min.js:10) at speedtest.js:39

Refused to load the image 'blob:http://pi.hole/b623d4e5-73f7-494a-b85f-277511bead6e' because it violates the following Content Security Policy directive: "default-src 'self' data: fonts.gstatic.com api.github.com pihole.speedtestcustom.com". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

speedtest.js:26 Uncaught TypeError: Cannot read property 'update' of undefined at Object.<anonymous> (speedtest.js:26) at j (jquery.min.js:2) at Object.fireWith [as resolveWith] (jquery.min.js:2) at x (jquery.min.js:4) at XMLHttpRequest.<anonymous> (jquery.min.js:4) (anonymous) @ speedtest.js:26 j @ jquery.min.js:2 fireWith @ jquery.min.js:2 x @ jquery.min.js:4 (anonymous) @ jquery.min.js:4 load (async) send @ jquery.min.js:4 ajax @ jquery.min.js:4 updateSpeedTestData @ speedtest.js:10 (anonymous) @ speedtest.js:34 setInterval (async) (anonymous) @ speedtest.js:32

Graph does not display at all. The Speedtests page works fine though.

Speedtest upload capped

Love the mod!

Only issue I seem to have is upload appears to show as capped at ~2.8 Mbits with very little deviation. Download looks good and will show appropriate deviations.

request - dump speedtest to csv locally or with gSYNC

i have a script running speedtest and parsing it to a local .csv which is synced to my Google Drive. it would be nice to eliminate this redundancy. Could the speedtest.db file be dumped to .csv or something or even have the pi-hole interface let me specify a link to regularly export the file to?

Retry failed aborting

This is on a Google Cloud Compute Engine VM on Ubuntu 18.04.4 LTS. The issue occurred when I had pihole v4 and still occurs after upgrading to v5.

speedtest-cli runs fine, returning:

Retrieving speedtest.net configuration...
Testing from Google Cloud...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Cox - Nova (Fairfax, VA) [21.49 km]: 13.976 ms
Testing download speed................................................................................
Download: 1192.34 Mbit/s
Testing upload speed................................................................................................
Upload: 542.49 Mbit/s

sudo pihole -a -sn however, returns this:


Testing Speed
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh: line 320:  4517 Killed                  $cmd > $log
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh: line 320:  4675 Killed                  $cmd > $log
Connection Failed Retry after 30 sec Connection Failed Retry failed aborting

The log shows this:

Retrieving speedtest.net configuration...
Testing from Google Cloud...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Xiber LLC (Washington, DC) [31.89 km]: 13.271 ms
Testing download speed................................................................................
Download: 1244.80 Mbit/s
Testing upload speed........................................................................

Limit bandwith to e.g. 80%

Hello, I love the speedtest integration to pihole. It gives me the ability to have a statistic on my internet speed which is great. My only issue is that when it does the speedtest, it really uses 100% of the bandwith. I've noticed that while playing games like e.g. Rocket League when the game suddendly starts to lag because my raspberry-pi would consume all the bandwith for the speedtest. Would it be possible to sort of limit the bandwith that is used for this?

Script seems to stop at "Get latest pakage from github"

Pretty much title, running on raspberry pi with it all the way updated, and pihole all the way updated, the script works all the way up to "Get latest pakage from github" and then just sits there forcing me to finish doing everything else manually. I've tried multiple times, along with letting it sit there for over 10+ minutes without it budging any.

Option to use official Speedtest CLI client

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.

Request/help: Several graphs if the device has more than one IP/connection

I also use my piHole as a VPN client for tunneling my DNS requests and therefore the speedtest is also being tunnelled.
Because the pi does not have enough processing power to use the full speed along with the overhead from the VPN around 1/5th of the actual speed is shown in the graph and I would like to make an additional test from eth0 also (instead of just tun0 right now).
I understand that this might be a very niche feature, but maybe you can point me in the right direction on how to do this with your script as a starting point?

(Never mind the ping, speedtest defaults to Denmark since I live in southern Sweden lol)
image

lighttpd error log

The GUI throws an error at $data = getSpeedTestData($dbSpeedtest,-1);
if($data['errr'])

indicating that errr is not defined as an index

ideas?

No Graphs

Hi,
I don't get graphs in the Pihole dashboard page. Instruction manual followed. What am I doing wrong?

Set specific time to run

On schedule it gives you options, every 1 hour, every 2 hours etc.

Is there and option to set it to run at specific times, eg. 00:00 & 06:00

Thanks

Result over last 24 hours instead over last 1 days

This is very minor, but other stats in the Pi-hole interface say "Queries over last 24 hours", it would match better if the Speedtest stat used the phrasing "Speedtest results over last 24 hours: instead of "Speedtest results over last 1 Days".

Speedtest Schedule: cannot change settings

I configured the scheduling to every hour (Settings->Speedtest->Speedtest Schedule).
Now I cannot revert it back to every 6 hours.
When I set the new value and apply, the old value (1 hour) remain.
I have tried to update PiHole, and also have reconfigured ("pihole -r") but problem still persist.

5.1 Update

FYI, after update it shows interface is out of date, and dark mode doesn't work.

Pi-hole Version v5.1.1 Web Interface Version v5.0.1 (Update available!) FTL Version v5.1

Integration to original project

Hi there,

Have you tried to open a feature PR in the original project adding this mod to the original project?
It would be great if pihole accepted this in their code. The installation would become easier to more people and the updates for pihole would be easier for everyone who had the mod.

Speedtest values are strange in the UI.

Hello,

My values in the webui are quite strange and much different than in the CLI.

Is that a bug in the latest version with the latest pihole version?

I'm running these versions:
Pi-hole Version v4.2.1 Web Interface Version v4.1.2 (Update available!) FTL Version v4.2.1

Speedtest Settings Always revert to Disabled

After initial install, I changed Speedtest settings from Disabled to Every 1 Hour and clicked save. The flag on the top showed that settings have been updated; however, the settings display disabled again immediately.

Did I screw up the install somehow?
See attached video:
PiHoleSpeeds

FTL Update throwing "404 Not Found"

Core is updated but whenever I try to update my FTL it stops with a 404
Terminal output is a follows:

 [i] FTL out of date

[i] FTL Checks...
[i] Downloading and Installing FTL...curl: (22) The requested URL returned error: 404 Not Found
[✗] Downloading and Installing FTL
Error: URL not found

Tried all the instrucions - changed resolv.conf to 8.8.8.8 - nothing works, it won't update.
Pihole Version and Web Interface are at 4.0
FTL is stuck at 3.0

update.sh is using an outdated fork

Hi arevindh, the One-click Update is using a fork that is on v5.0

#Update lastest speedtest-mod
cd /var/www/html
rm -rf admin_bak
mv admin admin_bak
git clone https://github.com/TooManyEggrolls/AdminLTE admin
#Update latest webpage.sh for speedtest-mod
cd /opt/pihole/
mv webpage.sh webpage.sh.org
wget https://github.com/TooManyEggrolls/pi-hole/raw/master/advanced/Scripts/webpage.sh
chmod +x webpage.sh

Speedtest on pihole representative?

First of all: thanks for this piece of software.

More of a general issue, whether the results of speedtest on PiHole actually representative are for the speeds on the rest of the network.

On my laptop (connected wireless 5Ghz):

Hosted by ...[3.08 km]: 15.687 ms
Download: 198.61 Mbit/s
Upload: 24.92 Mbit/s

PiHole speedtest (connected by CAT5 cable):

Hosted ... [2.69 km]: 24.043 ms
Download: 18.24 Mbit/s
Upload: 21.51 Mbit/s

Could this be because of the low specs of the RPi (version 1)? In this way, the PiHole speedtest is not really representative. Do I overlook something in my setup?

TIA.

Speedtest results inaccurate

Followed the instructions to install and update the Speedtest mod for pi-hole, however the results I'm getting are very very inaccurate.

5.1 Update - unable to change to Dark theme from Settings

After updating to the 5.1 Admin UI for pihole-speedtest, pihole > settings > API/Web Interface > Interface Appearance -- changing to "Dark theme" does set the Dark theme within that page, but the setting/variable for the theme is not saved beyond that. Navigating back to the Dashboard loads the light theme, and going back to the API/Web Interface setting also shows that the UI reverts to the light theme again.

Though I'm not 100% sure where the theme variable is stored, I'm presuming it should go into /etc/pihole/setupVars.conf. For now, I worked around the issue by saving /var/www/html/admin/style/themes/default-dark.css to default-light.css, after making backups of the originals. Just a quick hack to ensure the dark theme loads regardless of which theme is selected in Settings.

Can't Run Speedtest At All

I followed your steps in the Wiki and got everything installed. I had to manually install speedtest-cli because pip was installing the wrong version. Second: when I try to run the speedtest, I get the following error:

sudo pihole -a -sn
Testing Speed

/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh: line 320:  2868 Killed               $cmd > $log
/var/www/html/admin/scripts/pi-hole/speedtest/speedtest.sh: line 320:  2997 Killed               $cmd > $log
Connection Failed Retry after 30 sec Connection Failed Retry failed aborting

Notes:

Operating System: Debian 9
Version: Pi-hole 4.1 (Public)

Show failed speedtests as 0?

Might be nice to show failed speedtests as dl/up 0 in the graph? Had an internet outage today from for 11 hrs and looked back to see when the last successful test was run to see when it started and ended and if it was was working at all in between.

Thanks for the great work! Very useful!

Not able to disable the speedtest

Hi, I'm on Pihole 5.0 and I can't set the Speedtest Schedule to disabled. The speedtests are causing spikes in network graphs I'm monitoring on grafana so I wanted to turn them off. I don't want to remove the package as it's useful when diganostics.

Thanks.

pi-hole Web UI still showing 4.3.3 instead of 5.0

Version info is out-of-whack in pi-hole after updating pi-hole to 5.0, then running the speedtest mod update post 5.0 update.

I did the following after updating pi-hole to 5.0 to incorporate the speedtest mod back into pi-hole 5.0:


cd /var/www/html/
mv admin org_admin # remove old org_admin folder if exists
git clone https://github.com/arevindh/AdminLTE admin

Get latest webpage.sh file

cd /opt/pihole/
mv webpage.sh webpage.sh.org # remove old webpage.sh.org file if exists
wget https://github.com/arevindh/pi-hole/raw/master/advanced/Scripts/webpage.sh
chmod +x webpage.sh

Update version info

pihole updatechecker local


After "updating" the speedtest mod, within the CLI, running "pihole -v" returns the following:

Pi-hole version is v5.0 (Latest: v5.0)
AdminLTE version is v4.3.3-508-g25a0f385 (Latest: v5.0)
FTL version is v5.0 (Latest: v5.0)

The Web UI does look like 5.0 instead of 4.3 (left-hand menu is correct and has the new Local DNS and other links as pi-hole 5.0 should have), but the version is still reporting 4.3.3.

After Restart Pihole docker container dont start

[s6-finish] syncing disks.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] 01-resolver-resolv: applying...

[fix-attrs.d] 01-resolver-resolv: exited 0.

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] 20-start.sh: executing...

/root/ph_install.sh: line 48: setupVars: readonly variable

[cont-init.d] 20-start.sh: exited 1.

[cont-finish.d] executing container finish scripts...

[cont-finish.d] done.

[s6-finish] syncing disks.

[s6-finish] sending all processes the TERM signal.

[s6-finish] sending all processes the KILL signal and exiting.

Graphs issues from Left side to Right side.

The graph numbering is correct on the left side for speed, but as you go to the right side everything is multiplied by 10. Please correct the right side of the speedtest results graph.

screen shot 2018-09-28 at 7 11 36 am

problem with custom server

I'm currently using a custom server for my speedtest and idk how to remove it so yeah i want to know how do put it back to normal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.