Open nwh3365 opened 1 month ago
Huge +1 on this request. I currently constantly get threshold breach notifications because for whatever reason in ~90% of the cases „23M GmbH“ is chosen as server and at minimum 3 times per day only gets around 5 Mbps of a maximum 50 Upload. I already adjusted timing of the speedtests to avoid them running at the top of the hour.
I'll be honest with you on the little bit i've looked into this, it probably won't happen...
It'll be likely we'll have to rely on a specified list of servers (aka SPEEDTEST_SERVERS
), this is because if a server ID is not passed to the speedtest cli it chooses a random server and just starts the test. Based on what the cli returns there is a limited amount of configurations we can pass it.
# speedtest --help
Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.
Version: speedtest 1.2.0.84
Usage: speedtest [<options>]
-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)
--progress-update-interval=# Progress update interval (100-1000 milliseconds)
-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
I think this should be reasonably easy to implement.
speedtest -L returns a list of the ten closest servers:
speedtest -L Closest servers:
ID Name Location Country
==============================================================================
8862 CenturyLink Denver, CO United States
47683 NextLight Denver, CO United States
16797 Nitel Denver, CO United States
24079 ALLO - Denver Denver, CO United States
51010 Highline Denver, CO United States
23628 Whitesky Communications LLC Denver, CO United States
10051 Comcast Denver, CO United States
18847 Xiber LLC Denver, CO United States
9912 fdcservers.net Denver, CO United States
23971 Starry, Inc. Denver, CO United States
20818 Verso Networks Denver, CO United States
As you mentioned, when you run speedtest without specifying a server, it picks one on it's own. I had assumed (but cannot confirm) the servers are listed in order of closeness (i.e., the first one listed is the closest). In the limited testing I've done, when I didn't specify a server, it always picked the first one in the list. I have seen all of these servers appear in the Speedtest Tracker results, but an analysis of the results table indicates a very strong preference for one of the entries, which leads me to believe speedtest-cli is probably using the first entry in the list if you don't specify a particular server.
Count Pct ID Name
1261 54% 8862 CenturyLink
303 13% 47683 NextLight
254 11% 51010 Highline
221 10% 24079 ALLO - Denver
136 6% 18847 Xiber LLC
57 2% 23971 Starry, Inc.
34 1% 20818 Verso Networks
17 1% 23628 Whitesky Communications LLC
16 1% 9912 fdcservers.net
14 1% 14861 Aerux Broadband
4 0% 10051 Comcast
---------------------------------------------------
2317 100%
Since the Server ID is provided in the first column, you should be able to run speedtest -L, parse out the list of Server IDs, filter out the ones that are on the exclude list, then pick the first one from the list that remains and run speedtest -s ServerID.
Prior to finding Speedtest Tracker I used a shell script that basically worked like this. While it accomplished the task of logging recurring speedtest results so I could see changes over time, it didn't produce any of the nice charts that Speedtest Tracker does. I could do about any type of analysis I wanted, but it was a manual process. Speedtest Tracker is a huge improvement over that!
Good call on the servers first, I was thinking about it from a purely speedtest
cli perspective when running a test.
In https://github.com/alexjustesen/speedtest-tracker/pull/1464 (which is coming in 0.20.0
I introduced a new artisan app:ookla-list-servers
command to get the maximum servers from their API which happens to bump it up to 20.
In the call I'm taking the response which is in json and parsing it into a collection for easy display in the terminal, we could absolutely expand on this pattern and no longer rely on the speedtest cli to choose our server behind the scenes and instead get our list first and prune out anything we don't want then choose the random one.
Is your feature request related to a problem? No errors are being produced, but from practical data accuracy perspective it is an issue.
Please describe. There is a particular Speedtest server that is automatically selected as the best server for testing about 15% of the time. This server is consistently, and significantly slower than all other servers that have been selected for testing. The end result is that the Dashboard indicates significant fluctuations in download/upload speeds (i.e., whenever this particular server is selected for the test). In reality there isn't a performance issue with my Internet connection, but rather with that specific Speedtest server. I don't currently use thresholds for notifications, however this situation could potentially trigger notifications that seem to indicate an issue when in fact no real issue exists.
Describe the solution you'd like In short, I would like to be able to exclude such servers from testing.
I'm thinking in terms of a configuration option, "Exclude Speedtest Servers", that allows me to specify a list of servers to be excluded from testing. When a server is selected as the best server, the exclude list is checked to see if the server appears on the list. If it does, the next best server is selected and the exclusion check repeated until a server is found that is not on the exclude list.
I think it would be easiest to specify servers to be excluded by the server ID number since this is unique and readily available in the results display. Either enter the server ID number directly, or for better validity checking, display a pulldown selection box that is populated with all of the unique server IDs (with corresponding names as a visual verification) that appear in the results table (the list probably wouldn't be that long; my database only has 11 unique servers).
Additional context Add any other context or screenshots about the feature request here.