1
0
mirror of https://frontier.innolan.net/rainlance/amiga-fping.git synced 2025-11-23 18:31:16 +00:00

reorganized source directory

This commit is contained in:
David Schweikert
2012-02-19 23:16:53 +01:00
parent 5018cb8234
commit 01db781375
14 changed files with 444 additions and 1404 deletions

2
doc/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
man_MANS = fping.8
EXTRA_DIST = $(man_MANS)

411
doc/Makefile.in Normal file
View File

@ -0,0 +1,411 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
depcomp =
am__depfiles_maybe =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
man8dir = $(mandir)/man8
am__installdirs = "$(DESTDIR)$(man8dir)"
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
man_MANS = fping.8
EXTRA_DIST = $(man_MANS)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign --ignore-deps doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-man8: $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@list=''; test -n "$(man8dir)" || exit 0; \
{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.8[a-z]*$$/p'; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
done; }
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man8dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
test -z "$$files" || { \
echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man8
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man8
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man8 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-man uninstall-man8
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

43
doc/README.1992 Normal file
View File

@ -0,0 +1,43 @@
Original README (from 1992)
fping - A tool to quickly ping N number of hosts to determine
their reachability.
Roland J. Schemers III - Stanford University
schemers@Stanford.EDU
fping is a ping(1) like program which uses the Internet Control
Message Protocol (ICMP) echo request to determine if a host is
up. fping is different from ping in that you can specify any
number of hosts on the command line, or specify a file containing
the lists of hosts to ping. Instead of trying one host until it
timeouts or replies, fping will send out a ping packet and move
on to the next host in a round-robin fashion. If a host replies,
it is noted and removed from the list of hosts to check. If a host
does not respond within a certain time limit and/or retry limit it
will be considered unreachable.
Site
Stanford University has a large TCP/IP network with over 16,000
assigned IP addresses and over 100 IP subnets.
Problem and Issues
With a large a number of IP addresses in use, its becomes more and
more time consuming to check on which IP addresses are actively
in use, and which critical machines (routers, bridges, servers, etc)
are reachable. One example is we have a program which goes through
all of our routers arp caches looking for IP addresses that are in
use. After finding a list of IP addresses that aren't in any arp
caches fping can then be used to see if these IP addresses really
aren't being used, or are just behind the routers. Checking 2500
hosts (99% of which are unreachable) via ping can take hours.
fping was written to solve the problem of pinging N number of hosts
in an efficient manner. By sending out pings in a round-robin fashion
and checking on responses as they come in at random, a large number of
hosts can be checked at once.
Unlike ping, fping is meant to be used in scripts and its
output is easy to parse.

228
doc/fping.8 Normal file
View File

@ -0,0 +1,228 @@
.TH fping 8
.SH NAME
fping \- send ICMP ECHO_REQUEST packets to network hosts
.SH SYNOPSIS
.B fping
[ \fIoptions\fR ]
[ \fIsystems...\fR ]
.SH DESCRIPTION
.NXR "fping command"
.NXR "ICMP ECHO_REQUEST"
.B fping
is a program like
.B ping(8)
which uses the Internet Control
Message Protocol (ICMP) echo request to determine if a target host is
responding.
.B fping
differs from ping in that you can specify any
number of targets on the command line, or specify a file containing
the lists of targets to ping. Instead of sending to one target until it
times out or replies,
.B fping
will send out a ping packet and move
on to the next target in a round-robin fashion.
.PP
In the default mode, if a target replies,
it is noted and removed 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.
.B fping
also supports sending a specified number of pings to a target, or
looping indefinitely (as in
.B ping
).
.PP
Unlike
.B ping,
.B fping
is meant to be used in scripts, so its output is designed to be
easy to parse.
.SH OPTIONS
.IP \fB-a\fR 5
Show systems that are alive.
.IP \fB-A\fR 5
Display targets by address rather than DNS name.
.IP \fB-b\fIn\fR 5
Number of bytes of ping data to send. The minimum size (normally 12)
allows room for the data that
.B 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
.B ping.
Maximum is the theoretical maximum IP datagram size (64K), though most
systems limit this to a smaller, system-dependent number.
.IP \fB-B\fIn\fR 5
In the default mode,
.B 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.
.IP \fB-c\fR 5
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).
.IP \fB-C\fR 5
Similar to -c, but the per-target statistics are displayed 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.
.IP \fB-d\fR 5
Use DNS to lookup address of return ping packet. This allows you to give
fping a list of IP addresses as input and print hostnames in the output.
.IP \fB-e\fR 5
Show elapsed (round-trip) time of packets.
.IP \fB-f\fR 5
Read list of targets from a file. This option can only be used by the
root user. Regular users should pipe in the file via stdin:
% fping < targets_file
.IP \fB-g\fR 5
Generate a target list from a supplied IP netmask, or a starting and ending IP.
Specify the netmask or start/end in the targets portion of the command line.
ex. To ping the class C 192.168.1.x, the specified command line could look like either:
fping -g 192.168.1.0/24
or
fping -g 192.168.1.0 192.168.1.255
.IP \fB-h\fR 5
Print usage message.
.IP \fB-i\fIn\fR 5
The minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25).
.IP \fB-l\fR 5
Loop sending packets to each target indefinitely. Can be interrupted
with ctl-C; statistics about responses for each target are then displayed.
.IP \fB-m\fR 5
Send pings to each of a target host's multiple interfaces.
.IP \fB-n\fR 5
Same as -d.
.IP \fB-p\fR 5
In looping or counting modes (-l, -c, or -C), this parameter sets the
time in milliseconds that
.B fping
waits between successive packets to an individual target. Default is
1000.
.IP \fB-q\fR 5
Quiet. Don't show per-target results, just set final exit status.
.IP \fB-Q\fIn\fR 5
Like -q, but show summary results every n seconds.
.IP \fB-r\fIn\fR 5
Retry limit (default 3). This is the number of times an attempt at pinging
a target will be made, not including the first try.
.IP \fB-s\fR 5
Print cumulative statistics upon exit.
.IP \fB-S\fIaddr\fR 5
Set source address.
.IP \fB-I\fIif\fR 5
Set the interface (requires SO_BINDTODEVICE support)
.IP \fB-t\fIn\fR 5
Initial target timeout in milliseconds (default 500). In the default
mode, this is the amount of time that
.B fping
waits for a response to its first request. Successive timeouts are
multiplied by the backoff factor.
.IP \fB-T\fIn\fR 5
Ignored (for compatibility with fping 2.4).
.IP \fB-u\fR 5
Show targets that are unreachable.
.IP \fB-T\fIn\fR 5
Set the typ of service flag (TOS). \fIn\fR can be either decimal or hexadecimal (0xh) format.
.IP \fB-v\fR 5
Print
.B fping
version information.
.SH EXAMPLES
The following perl script will check a list of hosts and send mail if
any are unreachable. It uses the open2 function which allows a program
to be opened for reading and writing. fping does not start pinging the
list of systems until it reads EOF, which it gets after INPUT is closed.
Sure the open2 usage is not needed in this example, but it's a good open2
example none the less.
.nf
#!/usr/bin/perl
require 'open2.pl';
$MAILTO = "root";
$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -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;
}
.ni
Another good example is when you want to perform an action only on hosts
that are currently reachable.
.nf
#!/usr/bin/perl
$hosts_to_backup = `cat /etc/hosts.backup | fping -a`;
foreach $host (split(/\\n/,$hosts_to_backup)) {
# do it
}
.ni
.SH AUTHORS
.nf
Roland J. Schemers III, Stanford University, concept and versions 1.x
RL "Bob" Morgan, Stanford University, versions 2.x
David Papp, versions 2.3x and up,
David Schweikert, versions 3.0 and up
fping website: http://www.fping.org
.ni
.SH DIAGNOSTICS
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.
.SH BUGS
Ha! If we knew of any we would have fixed them!
.SH RESTRICTIONS
If certain options are used (i.e, a low value for -i and -t, and a
high value for -r) it is possible to flood the network. This program
must be installed as setuid root in order to open up a raw socket,
or must be run by root. In order to stop mere mortals from hosing the
network (when fping is installed setuid root) , normal users can't specify
the following:
.nf
-i n where n < 10 msec
-r n where n > 20
-t n where n < 250 msec
.ni
.SH SEE ALSO
netstat(1), ping(8), ifconfig(8c)