when running perl scripts through APM 4.0.2 SP 4 I am seeing issues where more often than not they fail with 'failed with 'Undefined' status. Script execution failed. Input string was not in a correct format.' I have searched the forums and seen that others are having these issues but there seems to have been no resolution, at least from what I can tell. the odd thing that I am having is that every once in a while it will pass. so I know it's not my script that is broken, is APM just not passing the correct input for my script.
here is a sample of one of my scripts checking time offset, ARGV[0] would be our NTP server. I can run the script on a server and it will pass every time, but running from APM it will fail about 60% of the time.
command line: perl ${SCRIPT} ntpserver
#!/usr/bin/perl -w # servicerestart.pl # Time offset test #god makes time.. I just make sure that it's right use strict 'vars'; if ($ARGV[0]) { my $offset = `sntp $ARGV[0] |cut -c29-37`; #print "$offset"; #my $mill = sprintf "%.0000000f", ($offset * 1000); #print $mill; if ($offset) { my $mill = sprintf "%.0000000f", ($offset * 1000); print "Message: current NTP offset time is $offset seconds\n"; print "Statistic: $mill \n"; exit (0); } else { print "could not connect to NTP server please check connections\n"; exit (1); } } else { print "did not recive NTP server\n"; exit (1); }