diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README | 19 | ||||
-rw-r--r-- | chart.gnuplot | 12 | ||||
-rwxr-xr-x | log.sh | 24 | ||||
-rwxr-xr-x | plot.sh | 1 | ||||
-rw-r--r-- | requirements.txt | 1 |
6 files changed, 59 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f10f56 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +log.tsv +.venv @@ -0,0 +1,19 @@ +# speedtest logger + +This is basically just speedtest-cli --csv running indefinetly + +## CSV layout + +The current CSV headers are: + +Server ID,Sponsor,Server Name,Timestamp,Distance,Ping,Download,Upload,Share,IP Address + +To get just the download speeds in Mbps you can do: + +tail -n +2 log.txt | cut -f7 | numfmt --to-unit=M + +and similarly with -f8 for upload speeds + +## Ploting + +I've added a gnuplot script to generate these as a plot straight from the raw log file
\ No newline at end of file diff --git a/chart.gnuplot b/chart.gnuplot new file mode 100644 index 0000000..1d674e3 --- /dev/null +++ b/chart.gnuplot @@ -0,0 +1,12 @@ +set datafile separator ' ' +#set xlabel "timestamp" +set ylabel "Mbps" +set title "Speedtest" +#set xdata time +#set timefmt "%Y-%m-%dT%H:%M:%S%Z" +#set format x "%m-%dT%H" +set format y "%.2s%cb" +#plot "log.tsv" using 4:7 with lines title "Download", \ +#"log.tsv" using 4:8 with lines title "Upload" +plot "log.tsv" using :7 with linespoint title "Download", \ +"log.tsv" using :8 with linespoint title "Upload"
\ No newline at end of file @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +WORKING_DIR=$(dirname $0) +python3 -m venv $WORKING_DIR/.venv +source $WORKING_DIR/.venv/bin/activate +python3 -m pip install -r $WORKING_DIR/requirements.txt + +if [[ $# -ne 1 ]]; then + echo "You must supply a target file" + exit 1 +fi + +OUTPUT=$1 + +if [[ ! -f $OUTPUT ]]; then + speedtest-cli --csv-header | sed -E 's/,/\t/g' > $OUTPUT +fi + +len=$(wc -l $OUTPUT | cut -d' ' -f1) +if [[ $len -le 0 ]]; then + speedtest-cli --csv-header | sed -E 's/,/\t/g' > $OUTPUT +fi + +speedtest-cli --csv-delimiter ' ' --csv >> $OUTPUT @@ -0,0 +1 @@ +gnuplot -p chart.gnuplot diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4b024b7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +speedtest-cli |