--- fping+args.monitor 2002/07/10 08:53:22 1.1 +++ fping+args.monitor 2002/07/10 10:04:48 1.3 @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # # Return a list of hosts which not reachable via ICMP echo # @@ -56,7 +56,20 @@ exit 0 if (@ARGV == 0); -open (IN, "$CMD @ARGV 2>&1 |") || +my @hosts; + +# you can use hosts in format host:optional configuration parameters and +# this part will strip everything after hostname +foreach (@ARGV) { + if (m/^[^:]+:?[^\@]*\@([^\/]+)\/?.*/) { + my $host = $1; + push @hosts,$host if (! grep /^$host$/,@hosts); + } else { + push @hosts,$_ if (! grep /^$_$/,@hosts); + } +} + +open (IN, "$CMD @hosts 2>&1 |") || die "could not open pipe to fping: $!\n"; my @unreachable; @@ -67,7 +80,7 @@ my @icmp; # ICMP messages output by fping my %addr_unknown; -my %want_host = map { $_ => 1 } @ARGV; # hosts fping hasn't output yet +my %want_host = map { $_ => 1 } @hosts; # hosts fping hasn't output yet while () {