We've all seen our ISPs crap out periodically. Things feel slow, we then go ping some server, and see lost packets or slow response times. When bitching to the ISP it's useful to have evidence so you can clearly explain exactly how they are fucking up. This happened to me again last week, so I wrote a quick oneliner to do the visualization. Here it is:

( echo '# i dt';
  ping 8.8.8.8 | perl -ne 'BEGIN { $|=1} next if /PING/; s/.*seq=([0-9]+).*time=([0-9]+).*/\1 \2/ && print') | \
tee /tmp/ping.vnl | \
vnl-filter --stream -p i,dt,di='diff(i)' | \
vnl-filter --stream --has di | \
feedgnuplot \
  --domain \
  --stream \
  --with 'linespoints pt 7 palette' \
  --tuplesizeall 3 \
  --ymin 0 \
  --set 'cbrange [1:]' \
  --xlabel "ping index" \
  --ylabel "Response time (ms)" \
  --title "ping 8.8.8.8 response times. Consecutive indices shown as colors"

You run that, and you get a realtime-updating plot of ping times and missed packets. The one-liner also logs the data to a file, so the saved data can be re-visualized. Showing what happens on my currently-working internet connection:

< /tmp/ping.vnl
vnl-filter -p i,dt,di='diff(i)' | \
vnl-filter --has di | \
feedgnuplot \
  --domain \
  --with 'linespoints pt 7 palette' \
  --tuplesizeall 3 \
  --ymin 0 \
  --set 'cbrange [1:]' \
  --xlabel "ping index" \
  --ylabel "Response time (ms)" \
  --title "ping 8.8.8.8 response times. Consecutive indices shown as colors" \
  --hardcopy /tmp/isp-good.svg

good.svg

On a broken network it looks like this (I edited the log to show the kind of broken-ness I was seeing earlier):

bad.svg

The x axis is the ping index. The y axis is the response time. Misses responses are shows as gaps in the points and also as colors, for legibility.

As usual, this uses the vnlog and feedgnuplot tools, so

sudo apt install feedgnuplot vnlog

if you want to try this