Hacker News new | past | comments | ask | show | jobs | submit login
gping: Ping, but with a graph (github.com/orf)
217 points by orf on Nov 13, 2020 | hide | past | favorite | 57 comments



I always liked gfblip: http://gfblip.appspot.com/

You can run this on your laptop and watch your WiFi drop in and out randomly (as other people around you download stuff, as Bluetooth devices interfere with it, etc.) It's also fun to run a speed test in another tab, and watch the latency increase 10x as needless buffers fill up and your latency-sensitive packets wait in line so your router gets a better review!


I found that tool from Ben Kuhn's blog, and at first it seemed great. But I've seen some weird behavior from it. Examples include drastically different behavior on a refresh (and not just for the 'blue' website, also for gstatic.com) and pings to Madagascar which are apparently faster than the speed of light. So now I'm somewhere between confused and distrustful.

If anyone has a detailed guide on using gfblip I'd be really curious to read it.


> If anyone has a detailed guide on using gfblip I'd be really curious to read it.

Check out the instructions in the GitHub repository, has two versions, neither are very long nor complex. https://github.com/apenwarr/blip


Regular old time series are such a powerful tool!


FYI - if you're getting a max red line on this site make sure you're not using the https version (and you may need to whitelist it in https-everywhere).


Intriguing, but: I don't think it's working as intended from my Brave browser.

After about 2 seconds of blue/green pings that seem faster than should be possible (<10ms), it goes full red.

It does work in Chrome! (Perhaps, Brave is doing some faster-fail on the probe request from the beginning, and then a cached-insta-failure after ~2 seconds?)


Had the same issue here, Brave blocks "insecure" scripts, you'll see a warning in the address bar and need to allow it to load those scripts to get it to work correctly.


Hmm, I'm not seeing that warning, & see the same problem behavior even with 'shields down' for the site.


My green pings to gstatic are steady, 19-21ms.

My blue pings to calgary are reliably ~2000ms then ~200ms. I wonder where in the chain that pattern is originating. I wonder if it'll stay like that over time.


Comparing performance of this page between Chromium and Firefox is just very depressing :(


Agree! I wonder why the performance in Chrome is so much worse than Firefox? I constantly have ~100ms higher values in Chrome than Firefox. Maybe the author is using Firefox for development, so the test is optimized for Firefox.

Chrome also seems to show red dots every ~3 seconds for me, while Firefox shows no red dots, strange.

Tested on Ubuntu.


the github description says that it is not directly measuring the roundtrip time but the time until the browser returns an xss-error.

so browsers behave differently...


That's a fun link.


Or you can do this in general:

  ping 8.8.8.8 | perl -ne 'BEGIN {$|=1;} s/.*=([0-9\.]+) ms$/\1/ && print'| feedgnuplot --stream --ylabel "Ping time (in ms)" --lines
Advantage: works for ANY input, not just pings. And is infinitely more flexible. Want a histogram of your pings updating in realtime? Here you go:

  ping 8.8.8.8 | perl -ne 'BEGIN {$|=1;} s/.*=([0-9\.]+) ms$/\1/ && print'| feedgnuplot --stream --histo 0 --binwidth 1


But therefore you need perl, gnuplot and feedgnuplot, the latter isn't even available via package manager on my distro.


Another great example how a couple of traditional unix tools (if you want to count perl and gnuplot as traditional unix tools) can replace 250 lines of high-level language code (https://github.com/orf/gping/blob/master/src/main.rs).


Fantastic, thanks, I think this was the final push I needed to start abusing gnuplot.

Though for some reason the plot only updates when I give or take the plot window focus (refreshperiod mentioned in the man page doesn't seem to help, and I think it should default to 1Hz).


Fix for this issue (on wayland) mentioned here: GDK_BACKEND=x11

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942570


A thing I’d really like and have contemplated making is graphs like this for mtr rather than ping. That way you can see how things are changing at each hop—if my network isn’t working perfectly, I always jump to mtr rather than ping, because it shows me whether the problem is between my laptop and the router, the router and the ISP, the ISP and the world, or near the end server. For best results you’d probably want a full 3D chart rather than just side-by-side 2D charts which is the best you could do in a terminal.


I like how the more recent versions of mtr have a coloured heat map, showing the 3D data, essentially.

(x=time of test, y=hops, z/color=ping time)


everyone should be familiar with the CLI tool 'mtr', which you can leave running for long periods of time inside a screen or termux session.

https://en.wikipedia.org/wiki/MTR_(software)


If you pass the -z switch to mtr, it also shows the associated AS.


prettyping[0] is a nice shell script that does a sparkline version of this.

[0] https://github.com/denilsonsa/prettyping


Just noting that this doesn’t seem to have a license, which makes using it in certain settings pretty iffy. Nice project, anyway!


The Cargo metadata says MIT.


Legit question, does that work? I thought the license needed to be included with the source.


I am not a lawyer.

Given that "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." is in the license, and it isn't included... I dunno.

But at the same time, the legal system doesn't work like code. It's more flexible. So, who knows?


Yeah, the license requiring itself to be included in copies was what I was thinking of. Not having it in there leaves it in a gray enough area that I would be hesitant to rely on it for something where the licensing was important. Very possible the metadata being there and indicating the unique(?) license identifier of “MIT” would be enough to convince a court in the event of Problems, but I also am not a lawyer and like my usage rights to be unambiguous.


Not related to but, as you can see a trend in the pings over time on the graph it reminds me that even in a very granular benchmark it can be very helpful to plot the results first before trying to process them.

For example, we sometimes blindly calculate the mean whereas the data may be such that we end up giving a value the benchmark will never reach.


Well pings will have a bit of a weird distribution. If you did a histogram of your ping for a bit you would see most values sitting near some "floor" of X ms and then a long right-sided tail of values much larger than X ms. It seems to look sorta like a gamma distribution from a quick test of my wi-fi ping. The mean would sit somewhere to the right of the largest mass of ping times. If you wanted to know where most pings were you could look at the median (which will sit right where most pings are). If you were interested in the really large values of X ms then you could compare the mean and median to find out just how much those slow ping responses are dragging your mean away from the median.


Shouldn't this be named nping? I'm not 100% serious there, but why break conventions? g is for GUI, n is fo TUI (from ncurses).


I didn’t put too much thought into the name. It’s ping, with a graph. Graph ping. gping.

nping does sound kind of interesting, but meh.


Perhaps add support for also getting the actual normal/regular ping output so one can have that along with the graph? Apologize if that’s already there I was just looking at the usage video and switches and it appears to only output a graph? Would seem useful to also have the normal/traditional ping output as well.


I'm curious what the usecase of monitoring ping graphs by themselves is. Other than comparing with the ping graph of another device, or complaining that your internet connection is poor... it seems like other investigative tools would be needed for diagnosing. Maybe I'm just not imaginative enough!


Very nice!

Noticed this uses pinger, which executes the actual ping command behind the scenes and parses the output. Which makes it fragile in case there are changes in the output format of ping. Are there any good alternative libraries that can use raw sockets, etc?


I’ve just updated pinger to use a windows-specific API that doesn’t need root. But yes, in general it’s a nightmare especially with ping executables that don’t report timeouts at all.

This is a great example of one of the failings of the UNIX model. You can’t really parse the ping output across distributions easily, it’s built for humans to consume and until recently didn’t even report timeouts to stdout. Not to mention needing to invoke “ping6” for ipv6, which I need to add support for.

However it’s the best way to do this without needing to run gping and root.


This is unlikely to change since if ping changes many programs would broke. It is kinda like ipconfig.

AFAIK, ping is a setuid binary (since it needs raw socket, that is a privileged operation) so a program that implements ping by itself would need to do the same (or it would work for root).


> It is kinda like ipconfig.

I assumed you were talking about windows until:

> AFAIK, ping is a setuid binary

Which unfortunately means you’ve partly helped make the GP’s point for them. Under Linux, the command you’re thinking of is ifconfig, which has long been deprecated and doesn’t ship by default anymore in newer distributions.

Times change, tools move on.


Nowadays, the CAP_NET_RAW "capability" allows opening raw sockets by unprivileged users and without making binaries setuid.


Weird! Not setuid on my ubuntu machine.


It's because of linux capabilities specificly CAP_NET_RAW

How to check:

    $ getcap $(which ping)
    /usr/bin/ping = cap_net_raw+ep
More about it on [1]

https://blog.container-solutions.com/linux-capabilities-in-p...


It is on my Ubuntu 18.04.5 LTS machine:

  -rwsr-xr-x 1 root root 64424 Jun 28  2019 /bin/ping


No longer on 20.10. Curious why it's different:

-rwxr-xr-x 1 root root 76744 Aug 23 15:08 /bin/ping


Checked an Ubuntu 20 machine and you're right. Instead ping has an extended attribute:

  % getcap /bin/ping
  /bin/ping = cap_net_raw+ep


My project, similar but different: https://github.com/brendanporter/duck


A great project Brendan. But as stated in Github issues, it is not worked on newer version of Go. I'm trying in Windows 10 and get error which look like:

`Error: 'date-time' main.go:59: open C:\Program Files Direct\duck\pings.json: The system cannot find the file specified.`

`not supported by windows. Request timeout for icmp_seq xx`


Looks great. How complicated to support multiple hosts? :)


That’s a really great idea. Not hard I don’t think


The cargo version seem to hanging on my ubuntu 20.04 machine and rust v1.47.


This makes reviewing pings much easier. Great job.


there is also https://noping.cc

available in many os-repos

supports tighter measurement intervals


215loc? This makes me want to (finally) sit and learn Rust. Even with Python + PyPi packages, I doubt you can do much better and still have a portable result.


This relies on libraries too.

I reckon a D implementation would be a little bit shorter, I might try and write one tomorrow.


Nice! Maybe a gtraceroute too?


mtr makes for a pretty decent gtraceroute


Pretty sweet


We should do gls next




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: