fping icon indicating copy to clipboard operation
fping copied to clipboard

request new option to support connectivity tests

Open rlhamil opened this issue 8 years ago • 3 comments

I'd like to see a new option to change the return code behavior from the default, so that if ANY host pings succeeded, the return code would be zero, even if not all succeeded or some IP lookups failed. Alternatively, a more generic option could take a numeric argument, and in addition to the above behavior, would randomly pick that number (after address resolution?) of hosts to ping out of a larger (potentially much larger) list. That would allow scripts doing such things to be used by many people, yet spread the load to the point that they weren't effectively causing a DoS attack on any one host.

Say the new option was -x (not suggesting that, although it is unused); for the simpler implementation, something like fping -x -q host1 host2 host3 would return zero if any of the three was resolvable and responded. For the more complicated approach, fping -x 2 -q host1 ... host99 would pick two hosts out of those of the 99 that resolved or didn't need name resolution, and if either responded, would return zero.

rlhamil avatar Aug 05 '16 13:08 rlhamil

I came here to request this, so, since the request already exists I'll just "me too".

Application: in my case, I want to bring up NIS to my corporate network when and only when I have IP connectivity to at least one of the N YP servers. Connectivity could be via direct LAN, on-campus wifi, or VPN from any other sort of network anywhere. And of course Everything Sucks when YP is "up" but connectivity is severed, so it has to die quickly when connectivity goes down; and rise from the dead reasonably quickly when connection is established.

fping, or even regular ping, already provides the needed functionality. A "tell me if any of these hosts are reachable" exit status is just a triviality to make scripting slightly easier. But still.

Seems like a generic "cause service P to be alive whenever any host in set Q is reachable (and not-alive when not, with some sort of tunable latency / hysteresis)" daemon should already exist; maybe I just need someone to remind me of its name?

filbo avatar May 04 '17 07:05 filbo

This feature seems to be available in fping, using the option -x, --reachable. @rlhamil: Can this issue be closed?

auerswal avatar Jan 09 '24 09:01 auerswal

Yes, --reachable does what I had in mind.

The DIAGNOSTICS portion of the man page currently (at least for what I have installed, which may not be the very latest) says Exit status is 0 if all the hosts are reachable, 1 if some hosts were unreachable, 2 if any IP addresses were not found, 3 for invalid command line arguments, and 4 for a system call failure.

Perhaps it should say Exit statius is 0 if all the hosts are reachable or the number of hosts specified by --reachable are reachable, [etc]

just so one doesn't have to read the entire man page to discover the exception.

On Jan 9, 2024, at 04:14, Erik Auerswald @.***> wrote:

This feature seems to be available in fping, using the option -x, --reachable. @rlhamil https://github.com/rlhamil: Can this issue be closed?

— Reply to this email directly, view it on GitHub https://github.com/schweikert/fping/issues/99#issuecomment-1882676865, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMF3PKYCAHWU64S43T5U53YNUDALAVCNFSM4CLWXZQ2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGI3DONRYGY2Q. You are receiving this because you were mentioned.

rlhamil avatar Jan 09 '24 17:01 rlhamil