fping icon indicating copy to clipboard operation
fping copied to clipboard

--alive and --count options mutual exclusive

Open psuet opened this issue 2 years ago • 3 comments

When using the --alive option in conjunction with the --count option, the --alive option is simply disregarded without any error or warning.

This behaviour is unintuitive, and the mutual exclusivity is not documented as far as I can see.

psuet avatar Feb 27 '23 14:02 psuet

Do you expect only the lines for targets for which no response at all was received to be omitted? E.g., as follows?

$ ./src/fping -u -c1 8.8.8.7 8.8.8.8 2>&1 | grep -v '/0/100%'
8.8.8.8 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 80.5/80.5/80.5

auerswal avatar Feb 04 '24 15:02 auerswal

Yes, similar, but --alive only outputs the IP instead of all this information.

$ ./src/fping -u -c1 8.8.8.7 8.8.8.8 2>&1 | grep -v '/0/100%' | cut -d: -f1 | xargs
8.8.8.8

My (former) usecase: I have a large Layer 2 Network (i know, i know) with some specialized hardware that sometimes swallows / rate-limits requests on first try. Thus I have to repeat requests to really get an accurate list of all alive devices.

psuet avatar Feb 04 '24 15:02 psuet

Ah, I made a mistake in my example, it should not have had the -u. I was thinking about:

$ fping -c3 8.8.8.7 8.8.8.8 2>&1 | grep -v -e '/0/100%' -e 'timed out'
8.8.8.8 : [0], 64 bytes, 65.3 ms (65.3 avg, 0% loss)
8.8.8.8 : [1], 64 bytes, 61.3 ms (63.3 avg, 0% loss)
8.8.8.8 : [2], 64 bytes, 64.2 ms (63.6 avg, 0% loss)

8.8.8.8 : xmt/rcv/%loss = 3/3/0%, min/avg/max = 61.3/63.6/65.3

I would expect that the --retry=N option together with --backoff 1 should help with your use case:

$ fping --retry 10 --backoff 1 --alive 8.8.8.7 8.8.8.8 
8.8.8.8

With --backoff 1, the pause between attempts is constant, as with --count N, but fping stops sending echo requests once it has received an answer.

auerswal avatar Feb 04 '24 15:02 auerswal