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 |
# |
# |
5 |
# Jim Trocki, trockij@transmeta.com |
# Jim Trocki, trockij@transmeta.com |
6 |
# |
# |
7 |
|
# This module is modified to recognize hosts in format |
8 |
|
# username[:password]@host/database ... |
9 |
|
# which is used my pgsql.monitor (of course, just host is used) by |
10 |
|
# Dobrica Pavlinusic, dpavlin@rot13.org |
11 |
|
# http://www.rot13.org/~dpavlin/sysadm.html |
12 |
|
# |
13 |
# $Id$ |
# $Id$ |
14 |
# |
# |
15 |
# Copyright (C) 1998, Jim Trocki |
# Copyright (C) 1998, Jim Trocki |
68 |
# this part will strip everything after hostname |
# this part will strip everything after hostname |
69 |
foreach (@ARGV) { |
foreach (@ARGV) { |
70 |
if (m/^[^:]+:?[^\@]*\@([^\/]+)\/?.*/) { |
if (m/^[^:]+:?[^\@]*\@([^\/]+)\/?.*/) { |
71 |
push @hosts,$1; |
my $host = $1; |
72 |
|
push @hosts,$host if (! grep /^$host$/,@hosts); |
73 |
} else { |
} else { |
74 |
push @hosts,$_; |
push @hosts,$_ if (! grep /^$_$/,@hosts); |
75 |
} |
} |
76 |
} |
} |
77 |
|
|