Linux for Network Engineers: How to use prettyping

Ping is one of the oldest and also most commonly used utilities for network testing and troubleshooting. We’ve talked about ping before and we’ve also talked about similar utilities such as nping and hping3.

Ping Output

What ping does (sending ICMP echo requests and measuring latency by reading the ICMP reply) is very simple and hasn’t changed since ping was first introduced. Consequently, the output of the ping utility hasn’t changed either in a long long time. And for good reasons I believe. There might be slight variations in the ping output among different OS’s, but if you used ping 20 years ago, and you use it today you should see the output formatted exactly the same way:

Once you terminate the ping process with Ctrl+C you see a summary of the statistics on the bottom.

Shortcomings

In most cases the regular ping output is all you need. For example, if you are trying to see if a host is reachable or what is the latency to a host, you are probably perfectly content.

For something more advanced though, such as getting a distribution of the latency, or getting a visual representation of the latency over a period of time, you’d have to use a spreadsheet or write a script that does parses and processes ping’s output.

If you have tried to do this, as you can imagine, you are not the first one. There are several ping wrappers out there, and here we’ll talk about prettyping.

Installation

Prettyping is a bash script that parses the output of the ping that you are already familiar with, and “prettyfies” its output. To install, all you have to do, is download, and execute it, as follows:

If you want you can move prettyping.sh to a directory found in the  $SOURCES 

On MaOS you can install it with:

Now you are ready to enjoy the pretty version of ping.

Prettyping supports all ping flags, and it also has a number of options that you can see with:

Prettyping

Here is how the output looks like when pinging in the  baidu.com 

Linux prettypingAs you may notice, prettyping keeps running until we hit Ctrl+Cand in a few lines it represents the output of 342 ping tests. The regular ping would need around 342 lines for the same output!

In addition, prettyping splits the latency in buckers and shows  its (in gray, green, red) the distribution

On the first line after the distribution graph, it shows the failed tests over the total number of packets sent, the minimum, average, and maximum latency value,, and the latency of the last ping tests performed.

The second line after the distribution graph, shows the same data as the first line, but now the statistics are calculated over the last minute.

The lost packets are displayed with a question mark for the ones that got lost.

The statistics are calculated in real-time.

Although the output of ping hasn’t changed in decades probably, utilities such as prettyping give a fresh look. All in all, it’s pretty straightforward to install and use.