Custom Script With Ssh

by Mar 6, 2012

The installation I inherited has custom scripts run our uptime 5 host (unix) to monitor various Oracle databases using SQL*Net. I'm trying to adapt these to monitor SAS servers using SSH, as follows:

1. set up a shell script

ssh -l myUserId -p 22 myUrl.com “/mySasDir/sas.servers status; exit;” >sasmon.txt
…. followed by script to parse the output of sasmon.txt to determine success or failure…

2. set up a public/private key and installed on host I want to monitor, so SSH doesn't prompt for a password.

3. executing the script from the unix command line succeeds but invoking the scripts via an uptime alert fails, leaving sasmon.txt empty.

4. When ssh is run in verbose mode (-v) it seems the uptime alert is trying to connect into the uptime host itself (rather than myUrl.com).

What am I missing? Is there a better way to do this?

Thanks,
Ken