Skip to content

Instantly share code, notes, and snippets.

@SkaTeMasTer
Created December 28, 2017 15:08
Show Gist options
  • Save SkaTeMasTer/b764b32365c9aab36a44c7c33b6197e3 to your computer and use it in GitHub Desktop.
Save SkaTeMasTer/b764b32365c9aab36a44c7c33b6197e3 to your computer and use it in GitHub Desktop.
Create a log file entry for speedtest-cli. Place this in /etc/cron.hourly directory for continuous logging coolness. Reports ping time, and upload / download speed.
#!/bin/sh
MSG=`speedtest-cli --simple | perl -pe 's/^(.*): (.*) (.*?)(\/s)?\n/"$1_$3": $2, /m' | cut -d',' -f 1-3`
logger "{\"speed\": {$MSG}}"
@SkaTeMasTer
Copy link
Author

Outputs JSON entry in /var/log/syslog:

Dec 28 09:17:57 PiHoleVPN logger: {"speed": {"Ping_ms": 353.071, "Download_Mbits": 9.92, "Upload_Mbits": 8.23}}

I like to run it more often though... hmm. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment