Figure 1: Using the Perl ping.pm module to check the availability of the Alias IP
sub PingHost{
# Subroutine for checking the availablity of a passed host.
# Returns true if host is alive or false if dead.
#
# NOTE: Specifying the ``icmp'' protocol requires that the program
# be run as root or that the program be setuid to root.
local($host)=@_;
$p = Net::Ping->new("icmp");
if ($p->ping($host,$PING_COUNT)){
return true;
}else{
return false;
}
undef($p);
}
|