in client_script/profile_reader.pl [250:296]
sub pingMetaDataControllers {
my $xsanNameServersConfigFile = read_file('/Library/Preferences/Xsan/fsnameservers');
my $data = {};
my $pingInt=1;
my $percentagePacketLoss = 0;
foreach(split(/\n/, $xsanNameServersConfigFile)){
my $pingStatus;
my $packetLoss;
my $iPAddress = $_;
if($iPAddress =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)
{
$iPAddress = $1;
}
my $pingResult = doPing($iPAddress);
if (defined $pingResult) {
$pingStatus = 'true';
$packetLoss = '0';
} else {
$pingStatus = 'false';
my $pingResults = 0;
for($pingCount=1;$pingCount<=10;++$pingCount) {
my $pingResultTwo = doPing($iPAddress);
if (defined $pingResultTwo) {
$pingStatus = 'true';
} else {
$pingResults++;
}
}
$percentagePacketLoss = $pingResults * 10;
}
my $percentagePacketLossForXML = 0;
if ($percentagePacketLoss != 0) {
$percentagePacketLossForXML = $percentagePacketLoss;
}
$data->{"$pingInt"}->{"ip"}="$iPAddress";
$data->{"$pingInt"}->{"ping"}="$pingStatus";
$data->{"$pingInt"}->{"packetloss"}="$percentagePacketLossForXML";
$pingInt = $pingInt + 1;
}
my $arrayOutput=[];
foreach(keys %$data){
my $updatedHash = $data->{$_};
$updatedHash->{"number"} = $_;
push @$arrayOutput, $updatedHash;
}
return $arrayOutput;
}