-Switch to using faster nmap as backend to pping.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3092 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-04-03 23:43:19 +00:00
parent ef438a4338
commit a9403e6d00

View File

@ -81,13 +81,17 @@ if ($interface) {
unless (scalar(@nodes)) {
exit;
}
open (FPING, "fping ".join(' ',@nodes). " 2> /dev/null|") or die("Cannot open fping pipe: $!");
while (<FPING>) {
if ($_ =~ /is unreachable/) {
s/ is unreachable/: noping/;
} elsif ($_ =~ /is alive/) {
s/ is alive/: ping/;
}
print $_;
my %deadnodes;
foreach (@nodes) {
$deadnodes{$_}=1;
}
open (FPING, "nmap -sP ".join(' ',@nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
while (<FPING>) {
if (/Host (.*) \(.*\) appears to be up/) {
print "$1: ping\n";
delete $deadnodes{$1};
}
}
foreach (sort keys %deadnodes) {
print "$_: noping\n";
}