Home
Name Modified Size InfoDownloads / Week
plotpings_2020-01-10.tar.xz 2020-01-10 20.8 kB
readme.md 2019-12-21 4.0 kB
plotpings_2019-12-21.tar.xz 2019-12-21 20.2 kB
Totals: 3 Items   45.0 kB 2

Start by compiling the program wherever it's going to live. It shouldn't need anything very fancy for libraries, as a guess install "build-essential" if you're running Debian/Raspbian/Ubuntu. And you need ping and probably Gnuplot, and a cron (I use Paul Vixie's cron).

Make sure the script that calls ping is executable, if it isn't do a chmod +x on it. Do a pwd to read the current directory accurately. Leave that terminal window for a minute and open another, type in "crontab -e". Which should open a crontab in your standard text editor. I do about everything as root, which you shouldn't be doing, but I've been doing it for 25 years. So do "sudo crontab -e". You can have a crontab as a non-root user but you want this to run run all the time, like a system process. Root's crontab does, non-root users may also have issues with network access.

See the crontab man page but every line has a format like

m h dom mon dow command

          • cd /usr/programs/scripts/tmobile ; ./wdata

The first 5 positions are minute, hour, day of month, month, day of week. To run something every minute just put 5 asterisks with spaces between. The end of the line is for the command to run, which can also be a few commands with ; between. Enter cd, space , then copy and paste the result of pwd where the script is. Add a space, ; and ./wdata. So every minute something's going to cd to this directory and run this script. Don't worry, you can comment it back out or delete it later. As soon as you save and quit your editor it should start gathering data.

The output of that looks like: ............................................................... xyzzy 1576902541 PING www.google.com (216.58.193.132) 56(84) bytes of data. 64 bytes from dfw25s34-in-f4.1e100.net (216.58.193.132): icmp_seq=1 ttl=53 time= 110 ms

--- www.google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 110.276/110.276/110.276/0.000 ms --end record-- xyzzy 1576902601 --end record-- ................................................................

Commented out lines in the wdata script will ping an IP address (8.8.8.8, Google's public DNS) instead of an address in case you don't want the variability of a DNS lookup. But for the big picture do the lookups. I'm checking reliablity of a T-Mobile setup here, which RF-wise is about -125 dbm so it's quite weak. Lately about 50% reliable though. This is rural internet, it's either a cell phone or a satellite dish. I also see problems because my cell phone kicks out of hotspot mode. I've been doing this a few years but on a different carrier.

So let it run a few minutes to get some example data, then run cpng from a command line. It spits out some statistics and calls Gnuplot which spits out a GIF.

I wrote it to look for dead times because they're infuriating if you're trying to do something else. In the output plot those are times where the trace plotted drops all the way to 0. But the peaks can also give a general idea of speed. Not throughput, that would require sending significant amounts of data around and timing it. Oh, feel free to rename things and make other changes.

Time zones get involved to a minor degree. I fetch times into the text file using 'date +"%s" >> pingdata' which always returns UTC. I have gmtoffset (top of the C file) set to -5.0 because I'm in EST, you'll probably want to change that. Either use your offset or set it to 0 for UTC output.

If you want to watch a live output do a tail -f on pingdata.

Stats at the commend line look like:

upstairs# ./cpng pingdata opened as input file 943 pings, 449 succeeded, rate is 47.614% Mean round trip time 78.82279 ms Plotted to pings_2019-12-21.gif

The gif name changes every day so old ones won't get clobbered, but nothing removes the old data. You could set that as a cron job to run at midnight. Also call cpng just before to be sure the day's data got plotted. No GUI needed.

Source: readme.md, updated 2019-12-21