Categories
DailyOps

How to pretty print ping output

Pretty print ping output using prettyping.

Clone source code.

$ git clone https://github.com/denilsonsa/prettyping
Cloning into 'prettyping'...
remote: Enumerating objects: 391, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 391 (delta 0), reused 3 (delta 0), pack-reused 384
Receiving objects: 100% (391/391), 535.04 KiB | 2.26 MiB/s, done.
Resolving deltas: 100% (170/170), done.

Inspect prettyprint shell script.

Put prettyprint shell script somewhere in PATH.

$ sudo cp prettyping /usr/bin  

Display help information.

$ prettyping --help
Usage: prettyping [prettyping parameters] 

This script is a wrapper around the system's "ping" tool. It will substitute
each ping response line by a colored character, giving a very compact overview
of the ping responses.

prettyping parameters:
  --[no]color      Enable/disable color output. (default: enabled)
  --[no]multicolor Enable/disable multi-color unicode output. Has no effect if
                     either color or unicode is disabled. (default: enabled)
  --[no]unicode    Enable/disable unicode characters. (default: enabled)
  --[no]legend     Enable/disable the latency legend. (default: enabled)
  --[no]terminal   Force the output designed to a terminal. (default: auto)
  --last        Use the last "n" pings at the statistics line. (default: 60)
  --columns     Override auto-detection of terminal dimensions.
  --lines       Override auto-detection of terminal dimensions.
  --rttmin      Minimum RTT represented in the unicode graph. (default: auto)
  --rttmax      Maximum RTT represented in the unicode graph. (default: auto)
  --awkbin   Override the awk interpreter. (default: awk)
  --pingbin  Override the ping tool. (default: ping)
  -6               Shortcut for: --pingbin ping6

ping parameters handled by prettyping:
  -a  Audible ping is not implemented yet.
  -f  Flood mode is not allowed in prettyping.
  -q  Quiet output is not allowed in prettyping.
  -R  Record route mode is not allowed in prettyping.
  -v  Verbose output seems to be the default mode in ping.

All other parameters are passed directly to ping.

Use prettyprint wrapper to display live statistics.

$ prettyping --nounicode debian.org
0 _ 20 . 40 o 60 O 80 _ 100 . 120 o 140 O 160 _ 180 . 200 o 220 O ∞
PING debian.org (130.89.148.77) 56(84) bytes of data.
o.................................................o............o...........................^C
 0/ 91 ( 0%) lost;   36/  37/  40ms; last:   36ms
 0/ 60 ( 0%) lost;   36/  37/  40/   1ms (last 60)
--- debian.org ping statistics ---
91 packets transmitted, 91 received, 0% packet loss, time 90123ms
rtt min/avg/max/mdev = 36.238/37.464/40.577/0.931 ms