The ISP I use at home is suffering from pretty bad congestion and the service has become barely usable during peak times. Despite multiple reports from other customers, they won’t admit that there is a problem, so it’s time to show them some data!
I put together a really quick and hacky shell script that grabs a large-ish file from their own speedtest server (within their network) and logs the max download speed to a CSV file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
File: bwtest.sh #!/bin/sh #script to test FTP download speed and log the result to a CSV #set the path to download target file TARGET="http://speedtest.amnet.net.au/speedtest/random2000x2000.jpg" #set the path to local log file LOGFILE="/home/pi/bandwidth-monitor/downloadlog" #set the path to the CSV output file CSVFILE="/home/pi/bandwidth-monitor/output.csv" #timestamp formatting for record TIMESTAMP=$(date +"%d/%m/%Y %H:%M:%S") #This ugly thing returns and writes the last lines of the results to file wget $TARGET /dev/null 2>&1 | tail -3 >> $LOGFILE #Now just get the MB/s.. Pretty hacky.. RESULT=$(cat $LOGFILE | tail -c 12 | sed -e 's/(\(.*\))/\1/' | head -c-5) #Write it to a CSV with timestamp echo "$TIMESTAMP, $RESULT" >> $CSVFILE #cleanup files, since the /dev/null bit didn't work.. #rm -rf test1* rm -rf random* echo "Record Saved at" $TIMESTAMP. Temp files deleted. |
I was going to build some sort of charting functionality into this, to spit out a rendered graph image or serves a webpage that has a web chart, but if you google ‘graphing library linux’ you immediately find RRDtool, and then if you keep going, you find Smokepin. So now the same Raspberry Pi also runs Smokeping.
This can chart not only ICMP, but also FTP (though due to limitations in RRDtool, the unit of ‘ms’ is hardcoded).
Here’s what it looks like when an ISP fixes their congestion issues:
Selecting the FTP chart will bring up something like the following:
Smokeping is a great tool. Stable, light, and set-and-forget.
Here’s my Probes config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
File: /etc/smokeping/config.d/Probes *** Probes *** + FPing binary = /usr/bin/fping +FTPtransfer destfile = /home/pi/bandwidth-monitor/test1MB.dat forks = 1 min_interval = 1 mode = get # mandatory offset = 50% srcfile = /public_html/test1MB.dat # mandatory step = 300 timeout = 60 # mandatory # The following variables can be overridden in each target section #localaddr = myhost-nat-if passive = yes pings = 5 port = 21 +DNS binary = /usr/bin/dig # mandatory forks = 5 offset = 50% step = 480 timeout = 15 # The following variables can be overridden in each target section lookup = www.whirlpool.net.au pings = 5 server = 203.167.127.1 |
And my Targets file looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
File: /etc/smokeping/config.d/Targets *** Targets *** probe = FPing menu = Top title = Network Latency Grapher remark = Welcome to this SmokePing website. + local menu = Local Hosts title = Local Network Devices ++ loopback host = 127.0.0.1 title = Localhost (127.0.0.1) ++ router host = 192.168.88.1 title = Local CPE Router/Gateway + amnet menu = Amnet network title = Hosts on Amnet network ++ amnet-FTP menu = Amnet FTP server host = 203.161.125.11 title = Amnet FTP (203.161.125.11) ++ amnet-DNS host = 203.161.127.1 title = Amnet DNS (203.161.127.1) menu = Amnet DNS ++ amnet-first-hop host = 203.161.65.253 title = Amnet First Hop (203.161.65.253) menu = First Hop ++ amnet-second-hop host = 203.161.65.41 title = Amnet Second Hop (203.161.65.41) menu = Second Hop ++ amnet-peer host = ******* title = Amcom Peer (10/10 Corp. Fiber) menu = Amcom Peer ++ another-peer host = 203.161.***.*** title = Amnet Peer (ADSL2+ Residential) menu = Amnet Peer remark = Another ADSL2+ customer + internet menu = Internet title = Internet hosts ++ google host = 8.8.8.8 title = Google DNS (8.8.8.8) menu = Google DNS FTP menu = FTP Throughput title = FTP throughput ++ Amnet-FTP remark = Time taken to fetch 1MB file from ftp.amnet.net.au (smaller is better). probe = FTPtransfer host = ftp.amnet.net.au passive = yes timeout = 120 username = $username password = $password port = 21 + DNS menu = DNS Servers ++ Amnet-DNS probe = DNS # if the default probe is something else host = 203.167.127.1 lookup = www.whirlpool.net.au pings = 5 server = 203.167.127.1 remark = 5 looksups to 203.167.127.1, every 8 mins title = Amnet DNS |
Rancilio Silvia mods - PID temperature control, repaint, and open bottom portafilter
I installed a cheap chinese PID controller inside my Rancilio Silvia V2 espresso machine. Modifying the machine with PID control is not an entirely new concept, however my decision to mount it inside ... Read more
Reading SNMP values from Mikrotik RouterOS into Mango Automation
If you use Mikrotik routerboard devices in your networking environment or for remote telemetry applications, you may be interested in retrieving some datapoints from the Routerboard using Mango's SNMP datasource module. In ... Read more