Internet speeds are tested against random servers from speedtest.net at an timed interval (defined by user).
If slow speed (defined by user) is detected, then runs a number of download and upload test with optional route tests to servers and writes to a logfile.
## Screenshots
Main UI with graph on.
![Screenshot 1]()
## Features
* Function for checking current bandwidth usage to block false positives. Can optionally collect bandwidth usage from a router running linux with a ssh server enabled.
* Scrollable graph showing speeds over time.
* All output in the UI is also scrollabe with UP, DOWN, PAGE_UP, PAGE_DOWN, HOME, END keys working as you would expect.
* Option to have the timer reset on any mouse or keyboard activity in XServer.
* Option to have the timer auto pause when monitor is on and unpause when monitor is off.
* Unit used can be switched between Mbits and MB/s.
* Function for splitting log files at a defined size, old log files can also be automatically compressed.
## Configurability
Config files stored in "$HOME/.config/spdtest" folder
-t, --test [num] Runs full test 1 or <x> number of times and quits
-u, --unit megabit/megabyte Which unit to show speed in, [default: megabit]
-s, --slow-speed speed Defines what speed in defined unit that will trigger more tests
-n, --num-servers num How many of the closest servers to get from speedtest.net
-i, --interface name Network interface being used [default: auto]
-l, --loglevel 0-3 0 No logging
1 Log only when slow speed has been detected
2 Also log slow speed check and server update
3 Log all including forced tests
-lf, --log-file file Full path to custom logfile, no log rotation is done on custom logfiles
-p, --paused Sets timer to paused state at startup
-wt, --wait-time HH:MM:SS Time between tests when NO slowdown is detected [default: 00:10:00]
-st, --slow-time HH:MM:SS Time between tests when slowdown has been detected, uses wait timer if unset
-x, --x-reset [HH:MM:SS] Reset timer if keyboard or mouse activity is detected in X Server
If HH:MM:SS is included, the script uses this timer until first test, then uses
standard wait time, any activity resets to idle timer [default: unset]
-d, --display-pause Automatically pauses timer when display is on, unpauses when off
-gs, --gen-server-cfg num Writes <x> number of the closest servers to "server.cfg" and quits
Servers aren't updated automatically at start if "server.cfg" exists
-sc, --server-config file Reads server config from <file> [default: server.cfg]
If used in combination with -gs a new file is created
-h, --help Shows help information
CONFIG:
Note: All config files are stored in: $HOME/.config/spdtest
spdtest.cfg Automatically created with default values if removed
[server.cfg] Stores server id's to use with speedtest, delete to refresh servers on start
[route.cfg] Additional hosts to test with mtr, see route.cfg.sample for formatting
LOG:
Logfile location can be changed in config file
Currently: $HOME/spdtest-logs
```
## Dependencies
**bash** (v4.4 or later) Script functionality might brake with earlier versions.
**[Python 3](https://www.python.org/downloads)** (v3.7 or later) Needed for speedtest-cli, grc and getIdle.
**[speedtest](https://www.speedtest.net/apps/cli)** Official speedtest client from Ookla, needs to be in path or defined in config.
**[jq](https://stedolan.github.io/jq/)** Needed for json parsing.
## Included
**[speedtest-cli](https://github.com/sivel/speedtest-cli)** Used to get serverlist, since official speedtest client from Ookla is limited to 10 servers.
Modified and heavily stripped down, based on version 2.1.2. Python code included in the script.
**[grc](https://github.com/garabik/grc)** For making text output in the UI pretty.
Modified version of grcat. Python code included in the script.
**getIdle** Get XServer idle time. Python code included in script.
## Optionals
**[mtr](https://github.com/traviscross/mtr)** Needed if you want to check routes to slow servers.
**[less](http://www.greenwoodsoftware.com/less/)** Needed if you want option to view logfile from UI.
## TODO
- [ ] TODO Fix argument parsing and error messages
- [ ] TODO Change slowtest to multiple servers and compare results
- [ ] TODO fix wrong keypress in inputwait, esc codes etc
- [ ] TODO fix up README.md
- [x] TODO extern config and save to config?
- [x] TODO ssh controlmaster, server, client for precheck_speed