}
}
sub read_pingomatic_hosts {
my $fh = shift;
my @hosts;
while(<$fh>) {
chomp;
next if /^$/;
next if /^\s*\#/;
if (/^\@(.*)\@$/) {
no strict 'refs';
push @hosts, &{"hostgroup_" . lc($1)};
} else {
push @hosts, pingomatic_host($_);
}
}
@hosts;
}
sub epoch2isodate {
my $time = shift;
my @l = gmtime $time;
sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
$l[5]+1900, $l[4]+1, $l[3],
$l[2], $l[1], $l[0]);
}
__END__
=head1 NAME
pingomatic - multiple ping to a number of hosts
=head1 DESCRIPTION
This utility pings to a number of hosts in parallel.
=head2 OPTIONS
=over 4
=item -hosts hostgroup
Use a predefined host group. Predefined host groups are: C<cpan>,
C<freebsd>, C<linux>, and C<search>.
=item -hostfile filename
Use another file with host names instead of the default
C<~/.pingomatic.hosts>.
=item -host hostname
=item -host hostname:port
=item -host hostname:port/protocol
Add the named hostname (optionally with a port in numerical or named
form) to the list of hosts. This option may be specified multiple
times. I<protocol> is also optional and may be something like C<tcp>
or C<icmp>.
=item -ns
Add the locally configured name servers from C</etc/resolv.conf> to
the list of hosts. This is the default, use C<-nons> to remove the
name servers.
=item -d | -debug
Turn debugging on. Debug info is saved to C</tmp/pingomatic.debug>.
=item -interval seconds | -update seconds
Specify an interval in seconds between sending pings. Default is one
second.
=item -log file
Write a tab separated logfile (append if it already exists) with the
per-host and per-interval ping values.
=back
=head2 KEYS
While the script is pinging, the user can use the following keys:
=over 4
=item a
Add interactively another host to the list. To check for a specific
port, use I<host>:I<port>.
=item +
Add one second to the current update interval. The default update
interval is one second.
=6= |