creating_the_speedtest_image_every_day
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| creating_the_speedtest_image_every_day [2024/02/23 17:03] – created steve | creating_the_speedtest_image_every_day [2025/01/16 23:06] (current) – steve | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Creating the SpeedTest image every day ==== | ==== Creating the SpeedTest image every day ==== | ||
| - | So, I like to see how much I'm getting for my $52 per month, so I wrote this script a long time ago to track upload, download and delay numbers across my network | + | So, I like to see how much I'm getting for my $62 per month, so I wrote this script a long time ago to track upload, download and delay numbers across my Internet |
| + | |||
| + | It uses the node.js fast-cli script by Sindre Sorhus from [[https:// | ||
| First, there are two scripts in / | First, there are two scripts in / | ||
| + | One, in bash script; | ||
| <code bash SpeedTest> | <code bash SpeedTest> | ||
| - | #!/usr/bin/bash | + | #!/bin/bash |
| # / | # / | ||
| # Quick and simple log file of connection speed tests | # Quick and simple log file of connection speed tests | ||
| - | # # SRJ 2016-12-26 | + | # SRJ 2016-12-26 |
| - | YM=$(date +%Y-%m) | + | # In crontab; |
| - | MT=$(date -d "+6 hours" +%Y-%m) | + | # 09 */6 * * * / |
| - | + | YM=$(date +%Y-%m) | |
| - | # Where we store data | + | |
| Log=~/ | Log=~/ | ||
| - | PLog=~/ | ||
| - | |||
| - | # Where we store images | ||
| ARG1="/ | ARG1="/ | ||
| ARG2="/ | ARG2="/ | ||
| - | + | PLog=~/ | |
| - | # Date format in the log file | + | |
| Date=$(date +" | Date=$(date +" | ||
| - | + | Data=($(/ | |
| - | # Install with; npm install --global fast-cli | + | |
| - | Data=($(/ | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | # Formated data; delay, download, upload | + | |
| FData=" | FData=" | ||
| - | |||
| - | # Save it to the log like; 2019-07-20 12:09 14.72 514.17 134.54 | ||
| echo " | echo " | ||
| - | |||
| - | # Dump the last 128 lines into the plotlog | ||
| tail -128 ${Log} > ${PLog} | tail -128 ${Log} > ${PLog} | ||
| - | + | / | |
| - | # Run the gnuplot script on the plotlog | + | if [ ${YM} != ${MT} ] |
| - | / | + | then |
| - | + | ||
| - | # If this is the end of the month, copy the current image to an archive image. | + | |
| - | if [ ${YM} != ${MT} ] | + | |
| - | then | + | |
| cp ${ARG1}.png ${ARG2}.png | cp ${ARG1}.png ${ARG2}.png | ||
| fi | fi | ||
| </ | </ | ||
| + | |||
| Part two, the gnuplot script; | Part two, the gnuplot script; | ||
| <code gnuplot PlotSpeedTest> | <code gnuplot PlotSpeedTest> | ||
| # | # | ||
| - | # / | + | # # / |
| # # SRJ 2016-12-26 | # # SRJ 2016-12-26 | ||
| fmt = ' | fmt = ' | ||
| Line 63: | Line 47: | ||
| set format x " | set format x " | ||
| set xtics rotate | set xtics rotate | ||
| - | set xlabel "Time, tics are daily, samples are every six hours (09 */6 * * *)... | + | set xlabel "Time, tics are daily, samples are every six hours (09 */6 * * *)...\nTested |
| - | Tested | + | |
| set autoscale y | set autoscale y | ||
| set autoscale xfix | set autoscale xfix | ||
| Line 72: | Line 55: | ||
| set grid | set grid | ||
| set key bottom left | set key bottom left | ||
| + | set key opaque | ||
| + | |||
| set output "/ | set output "/ | ||
| - | |||
| plot '/ | plot '/ | ||
| max_Dn = GPVAL_DATA_Y_MAX | max_Dn = GPVAL_DATA_Y_MAX | ||
| Line 93: | Line 77: | ||
| </ | </ | ||
| - | Part three, this is called by cron every six hours with; | + | |
| - | <code bash crontab> | + | Part three, this is called by cron every six hours with;< |
| 09 */6 * * * / | 09 */6 * * * / | ||
| </ | </ | ||
| - | It works well, I have a text log going back for years, I have monthly images saved in the web server, and one that updates every six hours that I link on my phone, just to brag; | + | |
| - | [[https:// | + | It works well, I have a text log going back for years, I have monthly images saved in the web server, and one that updates every six hours that I link on my phone, just to brag; [[https:// |
creating_the_speedtest_image_every_day.1708707817.txt.gz · Last modified: by steve
