/[mon-modules]/fping+args.monitor
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /fping+args.monitor

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Wed Jul 10 08:53:22 2002 UTC revision 1.3 by dpavlin, Wed Jul 10 10:04:48 2002 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl -w
2  #  #
3  # Return a list of hosts which not reachable via ICMP echo  # Return a list of hosts which not reachable via ICMP echo
4  #  #
# Line 56  my $END_TIME; Line 56  my $END_TIME;
56    
57  exit 0 if (@ARGV == 0);  exit 0 if (@ARGV == 0);
58    
59  open (IN, "$CMD @ARGV 2>&1 |") ||  my @hosts;
60    
61    # you can use hosts in format host:optional configuration parameters and
62    # this part will strip everything after hostname
63    foreach (@ARGV) {
64            if (m/^[^:]+:?[^\@]*\@([^\/]+)\/?.*/) {
65                    my $host = $1;
66                    push @hosts,$host if (! grep /^$host$/,@hosts);
67            } else {
68                    push @hosts,$_ if (! grep /^$_$/,@hosts);
69            }
70    }
71    
72    open (IN, "$CMD @hosts 2>&1 |") ||
73          die "could not open pipe to fping: $!\n";          die "could not open pipe to fping: $!\n";
74    
75  my @unreachable;  my @unreachable;
# Line 67  my @error;             # other errors which I'll gi Line 80  my @error;             # other errors which I'll gi
80  my @icmp;               # ICMP messages output by fping  my @icmp;               # ICMP messages output by fping
81  my %addr_unknown;  my %addr_unknown;
82    
83  my %want_host = map { $_ => 1 } @ARGV;  # hosts fping hasn't output yet  my %want_host = map { $_ => 1 } @hosts; # hosts fping hasn't output yet
84    
85  while (<IN>)  while (<IN>)
86  {  {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26