Could someone help me understand why this script fails? It works when I run it on the server with a little different verbage that writes to a logfile.
When I try to modify it to work in a app template it returns
Get Output Failed:
Can't identify dynamic column definitions from script output. Please, check if script output has properly formatted unique identifiers.
any help would be greatly appreciated.
#!/bin/perl -s
my $statistic = swift_status();
print "\n";
print "Testing: $statistic\n";
print "\n";
##################################################################################
# Returns status of Swift Adaptor: 0=Good/Up 1=Unknown Issue 2=Bad/Down
##################################################################################
sub swift_status
{ my $status=1;
my @check=`/SWIFTAlliance/RA/bin/swiftnet status`;
my $client="";
my $server="";
foreach my $check (@check)
{ chomp $check;
$client = $check if ($check =~ /qa_Client/o);
$server = $check if ($check =~ /qa_Server/o);
}
return($status=1) unless (length($client) && length($server));
if (($client =~ /UP$/) && ($server =~ /UP$/))
{ print "Message: Adapter is up\n";
print "Statistic: 0\n";
exit 0;
}
else { if (($client =~ /DOWN$/) || ($server =~ /DOWN$/))
{ print "Message: Adapter Status Unknown";
print "Statistic: 1\n";
exit 0;
}
}
print "Message: Adapter is down";
print "Statistic: 2\n";
exit 0
}