components/fping/fping.1m
changeset 6863 4eb57cfa3349
parent 6862 6cc42aa3b75a
child 6864 45128c94429d
equal deleted inserted replaced
6862:6cc42aa3b75a 6863:4eb57cfa3349
     1 '\" te
       
     2 .\"
       
     3 .\"  
       
     4 .TH fping 1M "29 Feb 2008" "SunOS 5.11" "System Administration Commands"
       
     5 .SH NAME
       
     6 fping \- send ICMP ECHO_REQUEST packets to network hosts
       
     7 .SH SYNOPSIS
       
     8 .B fping
       
     9 [ \fIoptions\fR ]
       
    10 [ \fIsystems...\fR ]
       
    11 
       
    12 .SH DESCRIPTION
       
    13 .NXR "fping command"
       
    14 .NXR "ICMP ECHO_REQUEST"
       
    15 
       
    16       
       
    17 .B fping 
       
    18 is a 
       
    19 .B ping
       
    20 like program which uses the Internet Control
       
    21 Message Protocol (ICMP) echo request to determine if a target host is
       
    22 responding. 
       
    23 .B fping 
       
    24 differs from ping in that you can specify any
       
    25 number of targets on the command line, or specify a file containing
       
    26 the lists of targets to ping. Instead of sending to one target until it
       
    27 times out or replies, 
       
    28 .B fping 
       
    29 will send out a ping packet and move
       
    30 on to the next target in a round-robin fashion. 
       
    31 .PP
       
    32 In the default mode, if a target replies,
       
    33 it is noted and removed from the list of targets to check; if a target
       
    34 does not respond within a certain time limit and/or retry limit it 
       
    35 is designated as unreachable.  
       
    36 .B fping 
       
    37 also supports sending a specified number of pings to a target, or
       
    38 looping indefinitely (as in 
       
    39 .B ping
       
    40 ).
       
    41 .PP
       
    42 Unlike 
       
    43 .B ping
       
    44 ,
       
    45 .B fping 
       
    46 is meant to be used in scripts, so its output is designed to be 
       
    47 easy to parse.
       
    48 .SH OPTIONS
       
    49 .IP \fB-a\fR 5
       
    50 Show systems that are alive.
       
    51 .IP \fB-A\fR 5
       
    52 Display targets by address rather than DNS name.
       
    53 .IP \fB-b\fIn\fR 5
       
    54 Number of bytes of ping data to send.  The minimum size (normally 12)
       
    55 allows room for the data that 
       
    56 .B fping 
       
    57 needs to do its work (sequence number, timestamp).  The reported
       
    58 received data size includes the IP header (normally 20 bytes) and ICMP
       
    59 header (8 bytes), so the minimum total size is 40 bytes.  Default is
       
    60 56, as in 
       
    61 .B ping.
       
    62 Maximum is the theoretical maximum IP datagram size (64K), though most
       
    63 systems limit this to a smaller, system-dependent number.
       
    64 .IP \fB-B\fIn\fR 5
       
    65 In the default mode,
       
    66 .B fping
       
    67 sends several requests to a target before giving up, waiting longer for
       
    68 a reply on each successive request.  This parameter is the value by
       
    69 which the wait time is multiplied on each successive request; it must
       
    70 be entered as a floating-point number (x.y).  The default is 1.5.
       
    71 .IP \fB-c\fR 5
       
    72 Number of request packets to send to each target.  In this mode, a
       
    73 line is displayed for each received response (this can suppressed with
       
    74 -q or -Q).  Also, statistics about responses for each target are displayed
       
    75 when all requests have been sent (or when interrupted).
       
    76 .IP \fB-C\fR 5
       
    77 Similar to -c, but the per-target statistics are displayed in a format
       
    78 designed for automated response-time statistics gathering.  For
       
    79 example:
       
    80 
       
    81 % fping -C 5 -q somehost
       
    82 
       
    83 somehost : 91.7 37.0 29.2 - 36.8
       
    84 
       
    85 shows the response time in milliseconds for each of the five requests,
       
    86 with the "-" indicating that no response was received to the fourth
       
    87 request.
       
    88 .IP \fB-d\fR 5
       
    89 Use gethostbyaddr(3NSL) to lookup address of return ping packet. This allows you to give
       
    90 fping a list of IP addresses as input and print hostnames in the output.
       
    91 .IP \fB-e\fR 5
       
    92 Show elapsed (round-trip) time of packets.
       
    93 .IP \fB-f\fR 5
       
    94 Read list of targets from a file.  
       
    95 
       
    96 % fping < targets_file
       
    97 
       
    98 .IP \fB-g\fR 5
       
    99 Generate a target list from a supplied IP netmask, or a starting and ending IP.
       
   100 Specify the netmask or start/end in the targets portion of the command line.
       
   101 
       
   102 ex. To ping the class C 192.168.1.x, the specified command line could look like either:
       
   103 
       
   104 fping -g 192.168.1.0/24
       
   105 
       
   106 or
       
   107 
       
   108 fping -g 192.168.1.0 192.168.1.255
       
   109 .IP \fB-h\fR 5
       
   110 Print usage message.
       
   111 .IP \fB-i\fIn\fR 5
       
   112 The minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25).
       
   113 .IP \fB-l\fR 5
       
   114 Loop sending packets to each target indefinitely.  Can be interrupted
       
   115 with ctl-C; statistics about responses for each target are then displayed.
       
   116 .IP \fB-m\fR 5
       
   117 Send pings to each of a target host's multiple interfaces.
       
   118 .IP \fB-n\fR 5
       
   119 Same as -d.
       
   120 .IP \fB-p\fR 5
       
   121 In looping or counting modes (-l, -c, or -C), this parameter sets the
       
   122 time in milliseconds that
       
   123 .B fping
       
   124 waits between successive packets to an individual target.  Default is
       
   125 1000.
       
   126 .IP \fB-q\fR 5
       
   127 Quiet. Don't show per-target results, just set final exit status.
       
   128 .IP \fB-Q\fIn\fR 5
       
   129 Like -q, but show summary results every n seconds.
       
   130 .IP \fB-r\fIn\fR 5
       
   131 Retry limit (default 3). This is the number of times an attempt at pinging
       
   132 a target will be made, not including the first try.
       
   133 .IP \fB-s\fR 5
       
   134 Print cumulative statistics upon exit.
       
   135 .IP \fB-t\fIn\fR 5
       
   136 Initial target timeout in milliseconds (default 500). In the default
       
   137 mode, this is the amount of time that 
       
   138 .B fping
       
   139 waits for a response to its first request.  Successive timeouts are
       
   140 multiplied by the backoff factor.
       
   141 .IP \fB-u\fR 5
       
   142 Show targets that are unreachable.
       
   143 .IP \fB-v\fR 5
       
   144 Print 
       
   145 .B fping
       
   146 version information.
       
   147 
       
   148 .SH EXAMPLES
       
   149 The following perl script will check a list of hosts and send mail if
       
   150 any are unreachable. It uses the open2 function which allows a program
       
   151 to be opened for reading and writing. fping does not start pinging the
       
   152 list of systems until it reads EOF, which it gets after INPUT is closed. 
       
   153 Sure the open2 usage is not needed in this example, but it's a good open2
       
   154 example none the less. 
       
   155 .nf
       
   156 
       
   157 #!/usr/local/bin/perl
       
   158 require 'open2.pl';
       
   159 
       
   160 $MAILTO = "root";
       
   161 
       
   162 $pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");
       
   163 
       
   164 @check=("slapshot","foo","foobar");
       
   165 
       
   166 foreach(@check) {  print INPUT "$_\\n"; }
       
   167 close(INPUT);
       
   168 @output=<OUTPUT>;
       
   169 
       
   170 if ($#output != -1) {
       
   171  chop($date=`date`);
       
   172  open(MAIL,"|mail -s 'unreachable systems' $MAILTO");
       
   173  print MAIL "\\nThe following systems are unreachable as of: $date\\n\\n";
       
   174  print MAIL @output;
       
   175  close MAIL;
       
   176 }
       
   177 
       
   178 .ni
       
   179 Another good example is when you want to perform an action only on hosts
       
   180 that are currently reachable.
       
   181 .nf
       
   182 
       
   183 #!/usr/local/bin/perl
       
   184 
       
   185 $hosts_to_backup = `cat /etc/hosts.backup | fping -a`;
       
   186 
       
   187 foreach $host (split(/\\n/,$hosts_to_backup)) {
       
   188   # do it
       
   189 }
       
   190 
       
   191 .ni
       
   192 .LP
       
   193 The following is an output example: 
       
   194 .sp
       
   195 \fB% fping a.b.com x.y.z.net 192.168.0.1 192.168.0.3\fR
       
   196 .in +2
       
   197 .nf
       
   198 a.b.com is alive
       
   199 x.y.z.net is alive
       
   200 192.168.0.1 is alive
       
   201 192.168.0.3 is alive
       
   202 .fi
       
   203 .in -2
       
   204 .sp
       
   205 .LP
       
   206 The following is an output example using the '-a' option: 
       
   207 .sp
       
   208 \fB% fping -a a.b.com x.y.z.net 192.168.0.1 192.168.0.3\fR
       
   209 .in +2
       
   210 .nf
       
   211 a.b.com
       
   212 x.y.z.net
       
   213 192.168.0.1
       
   214 192.168.0.3
       
   215 .fi
       
   216 .in -2
       
   217 .LP
       
   218 The following is an output example using the '-c' option: 
       
   219 .sp
       
   220 \fb% fping -c 3 a.b.com x.y.z.net 192.168.0.1\fR
       
   221 .in +2
       
   222 .nf
       
   223 a.b.com		: [0], 84 bytes, 51.1 ms (51.1 avg, 0% loss)
       
   224 192.168.0.1	: [0], 84 bytes, 0.08 ms (0.08 avg, 0% loss) [<- 192.168.0.4]
       
   225 x.y.z.net 	: [0], 84 bytes, 70.6 ms (70.6 avg, 0% loss)
       
   226 a.b.com		: [1], 84 bytes, 60.9 ms (56.0 avg, 0% loss)
       
   227 192.168.0.1	: [1], 84 bytes, 0.09 ms (0.08 avg, 0% loss) [<- 192.168.0.4]
       
   228 a.b.com		: [2], 84 bytes, 40.6 ms (50.9 avg, 0% loss)
       
   229 192.168.0.1	: [2], 84 bytes, 0.11 ms (0.09 avg, 0% loss) [<- 192.168.0.4]
       
   230 x.y.z.net		: [2], 84 bytes, 68.8 ms (69.7 avg, 33% loss)
       
   231 .sp
       
   232 a.b.com		: xmt/rcv/%loss = 3/3/0%, min/avg/max = 40.6/50.9/60.9
       
   233 x.y.z.net		: xmt/rcv/%loss = 3/2/33%, min/avg/max = 68.8/69.7/70.6
       
   234 192.168.0.1	: xmt/rcv/%loss = 3/3/0%, min/avg/max = 0.08/0.09/0.11
       
   235 .fi
       
   236 .in -2
       
   237 .LP
       
   238 The following is an output example using the '-C' option: 
       
   239 .sp
       
   240 \fb% fping -C 3 a.b.com x.y.z.net 192.168.0.1\fR
       
   241 .in +2
       
   242 .nf
       
   243 a.b.com		: [0], 84 bytes, 41.7 ms (41.7 avg, 0% loss)
       
   244 x.y.z.net		: [0], 84 bytes, 66.6 ms (66.6 avg, 0% loss)
       
   245 a.b.com		: [1], 84 bytes, 50.7 ms (46.2 avg, 0% loss)
       
   246 x.y.z.net		: [1], 84 bytes, 62.6 ms (64.6 avg, 0% loss)
       
   247 a.b.com		: [2], 84 bytes, 44.9 ms (45.8 avg, 0% loss)
       
   248 x.y.z.net		: [2], 84 bytes, 69.5 ms (66.2 avg, 0% loss)
       
   249 .sp
       
   250 a.b.com		: 41.74 50.72 44.94
       
   251 x.y.z.net		: 66.69 62.63 69.52
       
   252 192.168.0.1	: - - -
       
   253 .fi
       
   254 .in -2
       
   255 .LP
       
   256 The following is an output example using the '-e' option: 
       
   257 .sp
       
   258 \fb% fping -e a.b.com x.y.z.net 192.168.0.1\fR
       
   259 .in +2
       
   260 .nf
       
   261 a.b.com is alive (18.9 ms)
       
   262 x.y.z.net is alive (9.51 ms)
       
   263 192.168.0.1 is alive (0.35 ms)
       
   264 .fi
       
   265 .in -2
       
   266 .LP
       
   267 The following is an output example using the '-g' option: 
       
   268 .sp
       
   269 \fb% fping -g 192.168.0.1 192.168.0.6\fR
       
   270 .in +2
       
   271 .nf
       
   272 192.168.0.0 is alive [<- 192.168.0.4]
       
   273 192.168.0.4 is alive
       
   274 192.168.0.1 is unreachable
       
   275 192.168.0.2 is unreachable
       
   276 192.168.0.3 is unreachable
       
   277 192.168.0.5 is unreachable
       
   278 192.168.0.6 is unreachable
       
   279 .fi
       
   280 .in -2
       
   281 .LP
       
   282 The following is an output example using the '-s' option: 
       
   283 .sp
       
   284 \fb% fping -s a.b.com x.y.z.net 192.168.0.1\fR
       
   285 .in +2
       
   286 .nf
       
   287 a.b.com is alive
       
   288 x.y.z.net is alive
       
   289 192.168.0.1 is unreachable
       
   290 
       
   291        3 targets
       
   292        2 alive
       
   293        1 unreachable
       
   294        0 unknown addresses
       
   295 
       
   296        4 timeouts (waiting for response)
       
   297        6 ICMP Echos sent
       
   298        2 ICMP Echo Replies received
       
   299        0 other ICMP received
       
   300 
       
   301  46.1 ms (min round trip time)
       
   302  58.7 ms (avg round trip time)
       
   303  71.3 ms (max round trip time)
       
   304         4.153 sec (elapsed real time)
       
   305 .fi
       
   306 .in -2
       
   307 
       
   308 .SH AUTHORS
       
   309 .nf
       
   310 Roland J. Schemers III, Stanford University, concept and versions 1.x
       
   311 RL "Bob" Morgan, Stanford University, versions 2.x
       
   312 ZeroHype Technologies Inc. (http://www.zerohype.com), versions 2.3x and up,
       
   313 fping website:  http://www.fping.com
       
   314 .ni
       
   315 .SH DIAGNOSTICS
       
   316 Exit status is 0 if all the hosts are reachable, 1 if some hosts were
       
   317 unreachable, 2 if any IP addresses were not found, 3 for invalid
       
   318 command line arguments, and 4 for a system call failure.
       
   319 .SH BUGS
       
   320 Ha! If we knew of any we would have fixed them!
       
   321 .SH RESTRICTIONS
       
   322 Successful execution of this program requires that it be granted
       
   323 the net_icmpaccess privilege.
       
   324 
       
   325 .ni
       
   326 .SH SEE ALSO
       
   327 netstat(8), ping(8), ifconfig(8), rbac(7), privileges(7)
       
   328