Package: inetutils-ping
Version: 2:1.9.4-7
Severity: wishlist

It would be amazing useful, especially for plotting data and ingesting
into various monitoring systems to have an option (--time? --log?
--verbose?) that makes each "response/lack of response" lines have some
timestamp available, in machine readable form. Sticking to Unix timestamp
(microsecond resolution), or using LC_TIME or strftime format argument to
--time:

I.e.

# ping6 --numeric --interval=1000 --count=3 --time google.com
PING google.com (2a00:1450:400a:802::200e): 56 data bytes
64 bytes from 2a00:1450:400a:802::200e: icmp_seq=0 ttl=55 time=1.230 ms 
sent=1554913612.123456 received=1554913612.124676
64 bytes from 2a00:1450:400a:802::200e: icmp_seq=1 ttl=55 time=1.294 ms 
sent=1554913613.130000 received=1554913613.131294
64 bytes from 2a00:1450:400a:802::200e: icmp_seq=2 ttl=55 time=1.639 ms 
sent=1554913614.141000 received=1554913614.142639
--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.230/1.388/1.639/0.180 ms
#

timestamps could be seconds, or miliseconds to be consistent with time
and --interval options, as well with ICMP_TIMESTAMP feature (which is
orthogonal to this wishlist).

(using comma vs dot, depending on LC_ALL etc is optional, but would be
consistent with its use in time= and in round-trip min/avg/max/... stats)

The main reasoning is, that on Linux, doing pings using ICMP requires
super user to open raw socket, so if integreating into various systems,
one either need to install setuid binaries (which is a bit fragile and
possibly less secure) or use existing ping/ping6 tool installed.

>From normal user:

...
socket(AF_INET, SOCK_RAW, IPPROTO_ICMP) = -1 EPERM (Operation not permitted)
socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP) = -1 EACCES (Permission denied)
write(2, "ping: Lacking privilege for icmp"..., 41ping: Lacking privilege for 
icmp socket.
...

On Linux, it mighte be possible to access functionality using
CAP_NET_RAW, but 1) it again requires a setup, 2) allows too much than
only required functionality. On other kernels it could be even worse.

Adding timestamps would help a lot of this problem, as one could have
ping running continously for various targets, and just ingest its output
using pipes, named fifo or simply files for example. This alone would for
example help with constantly starting processes (currently the method
would be to send ~5 packets ever 100ms and then quit the ping), to have
approximate time and required stats. However this will lead to a lot of
forks, other overheads, and inprecise timeing.

Currently ping also do not report missing responses, even with --timeout
set manually, which is also unfortunate.

fping kind of provides similar functionality, i.e.

# fping --timestamp --loop -6 -A -d google.com
[1554914467.234919] zrh04s14-in-x0e.1e100.net (2a00:1450:400a:802::200e) : [0], 
64 bytes, 1.17 ms (1.17 avg, 0% loss)
[1554914468.235169] zrh04s14-in-x0e.1e100.net (2a00:1450:400a:802::200e) : [1], 
64 bytes, 1.35 ms (1.26 avg, 0% loss)
[1554914469.236207] zrh04s14-in-x0e.1e100.net (2a00:1450:400a:802::200e) : [2], 
64 bytes, 1.38 ms (1.30 avg, 0% loss)
[1554914470.237207] zrh04s14-in-x0e.1e100.net (2a00:1450:400a:802::200e) : [3], 
64 bytes, 1.35 ms (1.31 avg, 0% loss)

zrh04s14-in-x0e.1e100.net (2a00:1450:400a:802::200e) : xmt/rcv/%loss = 4/4/0%, 
min/avg/max = 1.17/1.31/1.38
#

but for non-root users persepective, ping is almost always installed, and
fping isn't. fping doesn't print missing responses either:

# fping --timestamp  -6 -A -d --count 10 2a00:1450:400a:802::3

2a00:1450:400a:802::3 (2a00:1450:400a:802::3) : xmt/rcv/%loss = 10/0/100%
#



Cheers,
Witold

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-2-amd64 (SMP w/32 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages inetutils-ping depends on:
ii  libc6     2.28-8
ii  libidn11  1.33-2.2
ii  netbase   5.5

inetutils-ping recommends no packages.

inetutils-ping suggests no packages.

-- no debconf information

Reply via email to