What have you tried?
What does your list of servers look like?
Post some code so we can look and make suggestions.
Update: Assuming you file has a server name on each line try the following..
open the Server List file
read in line by line
for each line/servername ping the server (either OS ping with $result = `ping $_`;then do some regex on the $result or look at Net::Ping)
close Server List file
The code below works for me using Net::Ping PS I havent done the open file and read in a list etc.
#! /usr/bin/perl
use strict;
use warnings;
use Net::Ping;
my ($host,$rtt,$ip);
my @host_array = ("OSSTNGMCN01", "OSSTNGMCN04", "PROJECTX99");
my $p = Net::Ping->new("syn");
$p->{port_num} = getservbyname("http", "tcp");
foreach $host (@host_array) {
$p->ping($host);
}
while (($host,$rtt,$ip) = $p->ack) {
print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
}
-----
Of all the things I've lost in my life, its my mind I miss the most.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.