|
|
|
|
@ -5,7 +5,21 @@
|
|
|
|
|
-%]
|
|
|
|
|
[% PERL -%]
|
|
|
|
|
my $gateway = (split(" ", `ip route | grep default`))[2];
|
|
|
|
|
my @nodes = (split(" ", `grep nameserver /etc/resolv.conf | cut -f2 -d' '|xargs`));
|
|
|
|
|
push(@nodes, $gateway);
|
|
|
|
|
my @nodes = ($gateway);
|
|
|
|
|
my @dnsnodes = (split(" ", `grep nameserver /etc/resolv.conf | cut -f2 -d' '|xargs`));
|
|
|
|
|
|
|
|
|
|
foreach my $host (@dnsnodes)
|
|
|
|
|
{
|
|
|
|
|
my $res = `/bin/ping -c 1 -s 164 $host -W 1 2>/dev/null`;
|
|
|
|
|
if ($res =~ '1 received')
|
|
|
|
|
{
|
|
|
|
|
if ($res =~ 'truncated') { print "#$host reply truncated\n"; }
|
|
|
|
|
else { push(@nodes, $host); }
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print "# $host error\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$stash->set(out => \@nodes);
|
|
|
|
|
[% END -%]
|
|
|
|
|
|