Kickstart has asked for the wisdom of the Perl Monks concerning the following question:
Thanks!
#!/usr/bin/perl -w use strict; use Net::Ping; # Var declaration my ($host, $x, $res); my $output = ''; # Servers that should be pingable at all times my @ext_servernames = qw( exchange milton border sequel faxserver troll vindex waifer ); sub ping_hosts { foreach $host (@ext_servernames) { my $p = Net::Ping->new; my $res = $p->ping($host); $output .= "Unknown host $host\n" unless defined $res; if (!$res) { $output .= "$host doesn't respond to ping requ +ests!\n"; } else { $output .= "$host is fine.\n"; } } } ping_hosts; # DEBUG print $res; print $output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Ping a list of servers
by grep (Monsignor) on Oct 18, 2002 at 22:58 UTC | |
by Kickstart (Pilgrim) on Oct 18, 2002 at 23:04 UTC | |
|
Re: Ping a list of servers
by mojotoad (Monsignor) on Oct 18, 2002 at 23:00 UTC | |
|
Re: Ping a list of servers
by drat (Hermit) on Oct 19, 2002 at 13:12 UTC | |
|
Re: Ping a list of servers
by traveler (Parson) on Oct 19, 2002 at 17:26 UTC | |
|
Re: Ping a list of servers
by grantm (Parson) on Oct 19, 2002 at 18:51 UTC |