I am running a very basic script to check the status of the BMC patrol agent on our unix servers. I am having consistenct issues. I am running a script that telnets to port 3181. If it returns "Who are you?" the agent is up and running. Using the following script works for most of the servers. The others I can ssh to the server from the APM server. I can login with the credentials I have set up. And I can then run the same command and get the proper return response. Any thought or ideas to help me get this consistently working would be appreciated. Also I am not much of a perl scripter so if there is a better way to do this feel free to let me know.
#!/usr/bin/perl
$patrol = `telnet localhost 3181 | grep Who | grep -v grep`;
if ( $patrol ne "" ) {
print $patrol;
print "Statistic: 0\n";
exit 0;
}
print "Statistic: 1\n";
exit 1;