use Net::SMTP;
@verify = ('smtp.host1.tld', 'smtp.host2.tld');
foreach $host (@verify)
{
$smtp = Net::SMTP->new($host);
if (ref($smtp))
{
print $smtp->banner();
}
else
{
print "failed $host!\n";
}
}
This kind of check probably is better than pinging a host,
but still doesn't tell you what is happening. A better solution
would be to download a file from every remote host to be
checked; if you can make these files contain some useful
informations, like uptime, load average and disk usage, you
can check what is happening and prevent also some kind of
errors (i.e. disk full).
You can generate those files automatically via a cron job
and download them via HTTP or FTP, as you prefer.
Ciao, Valerio |