orf / gping

Ping, but with a graph
MIT License
10.85k stars 314 forks source link

Missing packet loss rate info #114

Open kenchou opened 3 years ago

kenchou commented 3 years ago

ping result: 100 packets transmitted, 81 received, 19% packet loss, time 99425ms

gping missing info of packet loss

gregsadetsky commented 1 year ago

Seconded! Would be really great to see a different color on the plot for pings that timed out

skoehler commented 1 year ago

I'm afraid that gping is running the normal ping command and parses its output. The ping command prints about packet loss only when it terminates. gping should send the ping packets itself, and it should have a configurable timeout after which a packet is counted as lost. Only then gping can give you realtime statistics on how many packets have been dropped in total / over a given time window.

gregsadetsky commented 1 year ago

I'm not sure that I follow -- ping does print about lost packets as they are being sent... or are we talking about different things?

# I disconnected and reconnected my connection in the middle of this ping session
g@tr repo (main *%) % ping 8.8.8.8 
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=114 time=3.687 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=114 time=3.210 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=114 time=3.383 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=114 time=3.551 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=114 time=3.513 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=114 time=3.323 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=114 time=3.397 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=114 time=3.511 ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=114 time=3.240 ms
ping: sendto: No route to host
Request timeout for icmp_seq 9
ping: sendto: No route to host
Request timeout for icmp_seq 10
ping: sendto: No route to host
Request timeout for icmp_seq 11
ping: sendto: No route to host
[... snip ...]
Request timeout for icmp_seq 21
ping: sendto: No route to host
Request timeout for icmp_seq 22
ping: sendto: No route to host
Request timeout for icmp_seq 23
Request timeout for icmp_seq 24
64 bytes from 8.8.8.8: icmp_seq=25 ttl=114 time=4.090 ms
64 bytes from 8.8.8.8: icmp_seq=26 ttl=114 time=3.192 ms
64 bytes from 8.8.8.8: icmp_seq=27 ttl=114 time=3.433 ms
64 bytes from 8.8.8.8: icmp_seq=28 ttl=114 time=3.272 ms
64 bytes from 8.8.8.8: icmp_seq=29 ttl=114 time=3.199 ms
skoehler commented 1 year ago

Which version of ping is that? On Linux, the usual ping from the iputils package doesn't do that. I looked for an option to have that feature. I apparently missed it on my first look. But here it is:

$ ping -O 1.2.3.4
PING 1.2.3.4 (1.2.3.4) 56(84) Bytes an Daten.
noch keine Antwort für icmp_seq=1
noch keine Antwort für icmp_seq=2
noch keine Antwort für icmp_seq=3
^C
--- 1.2.3.4 ping-Statistik ---
4 Pakete übertragen, 0 empfangen, 100% packet loss, time 3040ms

$ LANG=C ping -O 1.2.3.4
PING 1.2.3.4 (1.2.3.4) 56(84) bytes of data.
no answer yet for icmp_seq=1
no answer yet for icmp_seq=2
no answer yet for icmp_seq=3
no answer yet for icmp_seq=4
no answer yet for icmp_seq=5
^C
--- 1.2.3.4 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5063ms

One problem with that is that it is localized depending on the locale.

kenchou commented 1 year ago

I'm afraid that gping is running the normal ping command and parses its output. The ping command prints about packet loss only when it terminates. gping should send the ping packets itself, and it should have a configurable timeout after which a packet is counted as lost. Only then gping can give you realtime statistics on how many packets have been dropped in total / over a given time window.

emm... You're right. It parses the output results of the ping command.

https://github.com/orf/gping/blob/master/pinger/src/linux.rs#L12-L16 https://github.com/orf/gping/blob/master/pinger/src/lib.rs#L42-L53

topranks commented 4 months ago

Seconded! Would be really great to see a different color on the plot for pings that timed out

Yes this would be really cool. I only discovered the tool and I love it, as a network engineer the really big use-case I have for it is during maintenances to have one screen with an "at-a-glance" view of whether a set of servers/network devices are reachable.

A clear visual indication of a particular target being down (no echo-reply received) would be really useful. Changing to a preset colour to represent this (red?) or altering how the line appears somehow could be good.

But either way love gping excellent work!

ruppde commented 2 months ago

One problem with that is that it is localized depending on the locale.

you could just check if the line starts with the ping size and/or ends with a sequence number, that should be language independent.

no answer yet for icmp_seq=1
64 bytes from 1.1.1.1: icmp_seq=2 ttl=64 time=335 ms

Japanese ping:


 PING 1.1.1.1 (1.1.1.1) 56(84) バイトのデータ
64 バイト応答 送信元 1.1.1.1: icmp_seq=1 ttl=58 時間=16.0ミリ秒
--- 1.1.1.1 ping 統計 ---
送信パケット数 2, 受信パケット数 2, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 14.908/15.472/16.037/0.564 ms```
krypdoh commented 1 month ago

Possible to add the total summary output that the default ping produces when exiting gping (q) ?

Quitting ping produces: Ping statistics for 127.0.0.1: Packets: Sent = 9, Received = 9, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms