SYNOPSIS
fping [options] [systems]
DESCRIPTION
fping is a ping-like utility that uses the Internet Control Message Protocol (ICMP) echo request to determine if a target host is responding. fping differs from ping in that you can specify any number of targets on the command line, or specify a file containing the list of targets to ping. Instead of sending to one target until it times out or replies, fping sends out a ping packet and moves on to the next target in a round-robin fashion,
In the default mode, if a target replies, fping notes it and removes it from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. fping also supports sending a specified number of pings to a target, or looping indefinitely (as in ping).
Unlike ping, fping is meant to be used in scripts, so its output is designed to be easy to parse.
Options
-a -
displays systems that are alive.
-A -
displays targets by address rather than DNS name.
-b n-
specifies the number of bytes of ping data to send. The minimum size (normally 12) allows room for the data that fping needs to do its work (sequence number, timestamp). The reported received data size includes the IP header (normally 20 bytes) and ICMP header (8 bytes), so the minimum total size is 40 bytes. Default is 56, as in ping. Maximum is the theoretical maximum IP datagram size (64K), though most systems limit this to a smaller, system-dependent number.
-B n-
in the default mode, fping sends several requests to a target before giving up, waiting longer for a reply on each successive request. This parameter is the value by which the wait time is multiplied on each successive request; it must be entered as a floating-point number (x.y). The default is 1.5.
-c n-
specifies the number of request packets to send to each target. In this mode, fping displays a line 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). -C n-
is similar to
-c , but fping displays the per-target statistics in a format designed for automated response-time statistics gathering. For example:%fping -C 5 -q somehost somehost : 91.7 37.0 29.2 - 36.8
shows the response time in milliseconds for each of the five requests, with the - indicating that no response was received to the fourth request.
-d -
uses DNS to lookup address of return ping packet. With this option, you can specify a list of IP addresses as the systems arguments and have fping display hostnames in the output.
-e -
shows elapsed (round-trip) time of packets.
-f file-
reads the list of targets from a file. This option can only be used by the root user. Regular users should pipe in the file via standard input:
% fping < targets_file
-g -
generates a target list from a supplied IP netmask, or a starting and ending IP. The netmask or starting/ending IPs are specified in the systems portion of the command line. For example, to ping the class the C 192.168.1.x, the command line could look like either:
fping -g 192.168.1.0/24
or
fping -g 192.168.1.0 192.168.1.255
-h -
displays usage message.
-i n-
specifies the minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25).
-l -
loops sending packets to each target indefinitely. The looping can be interrupted with CTRL-C; fping then displays statistics about responses for each target.
-m -
sends pings to each of a target host's multiple interfaces.
-n -
is the same as the
-d option. -p n-
in looping or counting modes (
-l ,-c , or-C , specifies the time in milliseconds that fping waits between successive packets to an individual target. The default is 1000. -q -
enables quiet mode. fping does not show per-target results; it just sets the final exit status.
-Q n-
is similar to
-q , but displays summary results every n seconds. -r n-
specifies the retry limit (the default is 3). This is the number of times an attempt at pinging a target is made, not including the first try.
-s -
displays cumulative statistics upon exit.
-t n-
specifies the initial target timeout in milliseconds (the default is 500). In the default mode, this is the amount of time that fping waits for a response to its first request. Successive timeouts are multiplied by the backoff factor.
-u -
displays targets that are unreachable.
-v -
displays fping version information.
EXAMPLES
The following perl script checks a list of hosts
and sends mail if any are unreachable.
It uses the
#!/usr/bin/perl require 'open2.pl'; $MAILTO = "root"; $pid = &open2("OUTPUT","INPUT","fping.exe -u"); @check=("slapshot","foo","foobar"); foreach(@check) { print INPUT "$_\n"; } close(INPUT); @output=<OUTPUT>; if ($#output != -1) { chop($date=`date`); open(MAIL,"|mail -s 'unreachable systems' $MAILTO"); print MAIL "\nThe following systems are unreachable as of: $date\n\n"; print MAIL @output; close MAIL; }
Another good example is when you want to perform an action only on hosts that are currently reachable:
#!/usr/bin/perl $hosts_to_backup = `cat /etc/hosts.backup | fping -a`; foreach $host (split(/\n/,$hosts_to_backup)) { # do it }
DIAGNOSTICS
Possible exit status values are:
- 0
-
Successful completion; all specified hosts were reachable.
- 1
-
At least one specified host was not reachable.
- 2
-
At least one IP address was not found.
- 3
-
There were invalid arguments on the command line.
- 4
-
A system call failure occurred.
AUTHORS
Roland J. Schemers III, Stanford University, concept and versions 1.x RL "Bob" Morgan, Stanford University, versions 2.x ZeroHype Technologies Inc. (http://www.zerohype.com), versions 2.3x and up,
fping website: http://www.fping.com
WARNING
When certain options are used (that is, a low value for
-i n where n < 10 msec-r n where n > 20-t n where n < 250 msec
AVAILABILITY
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.4 Documentation Build 39.