This is a tool to monitor your internet connection speed using the Ookla speedtest CLI tool together with a bit of bash and PHP.
It's really simple:
- A cron triggers a bash-script every x minute (every 15 or 30 minute is recommended).
- The bash-script runs the Ookla Speedtest binary.
- The output of the bash-script gets appended to a logfile.
- The logfile is read by a PHP-script which calculates and dislays the result.
Some ISP's require that you must prove that your connection speed is lower than what you pay for. This tool might be helpful to document the actual delivery of bandwidth and speed.
Be sure to have the Ookla Speedtest CLI installed. More details here: https://www.speedtest.net/apps/cli
Also run composer install
in the project root to pull in PHP dependencies.
Copy ".env.example" to ".env" and specify the log file path.
The command below will run every 15 minute:
*/15 * * * * /path/to/speedtest.sh >> /path/to/speedtest.log
Make sure that the bash-script is executable by running chmod +x speedtest.sh
.
Use https://crontab.guru/ if you are unsure about how to specify the time in the crontab.
The results can be seen by executing the following PHP-file via the CLI:
./average-speed.php
Make sure that the file is executable. If not then run:
chmod +x average-speed.php
- CSV-export
- Smarter storage - maybe in a SQLite-file instead?
- A better way of generating statistics - maybe via SQL?