Recently I was discussing some problems occurring on my landline with my ISP’s customer service, and some connectivity issues that they couldn’t fix. After sending them a couple of traceroutes, pings, router logs, I also decided to plot some of the data for them, because they seemed having difficulties to spot the problems.
So I made a simple bash command to store the ping time values in a file and plot it with Gnuplot. This is the command you can execute in your terminal / shell :
1 |
ping -c 100 www.google.co.uk | awk -F [=\ ] {'print $(NF-1)'} | grep -E "[0-9]" > pingTimes.dat |
This will create a file called ‘pingTimes.dat’ only containing the time values of 100 pings.
Afterwards, the file can be plotted using Gnuplot and this simple script :
1 2 3 4 5 |
set terminal pdfcairo font "Gill Sans,9" linewidth 2 rounded fontscale 1.0 set output "ping.pdf" set ylabel "Time in milliseconds" set xlabel "Number of Pings" plot "pingTimes.dat" w lp |
This will create a PDF file of the pings, containing a similar plot :
The code is also available on github.
Post a Comment