Is it possible to get the latency/RTT value with the fping command? I have tried the following:
~# fping askubuntu.com
All I am getting is:
askubuntu.com is alive
The reason I want to use fping is because I need to run ping in bulk.
Use -c
and give a number of pings to send to each host:
fping -c 10 192.168.1.1 192.168.1.2 ...
What does -c
do?
-c n Number of request packets to send to each target. In this mode, a
line is displayed for each received response (this can suppressed
with -q or -Q). Also, statistics about responses for each target
are displayed when all requests have been sent (or when
interrupted).
Example:
$ fping -c 5 192.168.1.1 192.168.1.50
192.168.1.1 : [0], 84 bytes, 1.56 ms (1.56 avg, 0% loss)
192.168.1.50 : [0], 84 bytes, 2.01 ms (2.01 avg, 0% loss)
192.168.1.1 : [1], 84 bytes, 1.39 ms (1.47 avg, 0% loss)
192.168.1.50 : [1], 84 bytes, 4.69 ms (3.35 avg, 0% loss)
192.168.1.1 : [2], 84 bytes, 2.06 ms (1.67 avg, 0% loss)
192.168.1.50 : [2], 84 bytes, 2.79 ms (3.16 avg, 0% loss)
192.168.1.1 : [3], 84 bytes, 1.97 ms (1.74 avg, 0% loss)
192.168.1.50 : [3], 84 bytes, 32.6 ms (10.5 avg, 0% loss)
192.168.1.1 : [4], 84 bytes, 1.41 ms (1.67 avg, 0% loss)
192.168.1.50 : [4], 84 bytes, 8.74 ms (10.1 avg, 0% loss)
192.168.1.1 : xmt/rcv/%loss = 5/5/0%, min/avg/max = 1.39/1.67/2.06
192.168.1.50 : xmt/rcv/%loss = 5/5/0%, min/avg/max = 2.01/10.1/32.6
The numbers in the summary line show you the response times you want. If you only want the summary and not the ping-by-ping report, use -q -c
. If you want to then process the result with a script (i.e. you want something easy to parse), use -C
instead, it will give you just the numbers separated by spaces.
I learned about this very easily by doing man fping
. Remember, man
is your friend :)
man
but failed to notice the -c
parameter :) Thanks.