Forum Discussion

Christopher_Boo's avatar
Christopher_Boo
Icon for Cirrostratus rankCirrostratus
Sep 03, 2010

Debugging external health monitor script - Getting "Unable to open input file" in the debug logs

This is for a sharepoint health monitor I've created based on examples found in these forums. The script works great from shell, but as a health monitor I get this in the debug logs. I''ve got permisssions on the script set to 755. This is my first external script and I'm sure I'm doing something stupid, but I really need to get this figured out before next week.

 

 

The debug error

 

 

Arguments 1-2:

 

::ffff:10.9.0.141

 

80

 

 

Environment variables:

 

DEBUG=yes

 

FILENAME=/usr/bin/monitors/sharepoint

 

MON_TMPL_NAME=sharepoint

 

NODE_IP=::ffff:99.99.99.99

 

NODE_PORT=80

 

unable to open input file /usr/bin/monitors/sharepoint

 

 

The script

 

 

!/bin/sh remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format) IP=`echo ${1} | sed 's/::ffff://'` IP=${1} PORT=${2} PIDFILE="/var/run/`basename ${0}`.${IP}_${PORT}.pid" kill of the last instance of this monitor if hung and log current pid if [ -f $PIDFILE ] then kill -9 `cat $PIDFILE` > /dev/null 2>&1 fi echo "$$" > $PIDFILE send request & check for expected response /usr/bin/curl -L --ntlm -k -v --user 'user:password' -H "Host:99.99.99.99" | grep -i " World Medical" 2>&1 > /dev/null mark node UP if expected response was received if [ $? -eq 0 ] then echo "UP" fi rm -f $PIDFILE exit

 

 

What is returned when I run the script from shell

 

 

login as: admin Using keyboard-interactive authentication. Password: Last login: Fri Sep 3 10:36:18 2010 from 10.13.1.47 [admin@xxxxx:Standby] ~ cd /usr/bin/monitors [admin@xxxxx:Standby] monitors sh -x sharepoint ++ echo ++ sed s/::ffff:// + IP= + PORT= ++ basename sharepoint + PIDFILE=/var/run/sharepoint._.pid + '[' -f /var/run/sharepoint._.pid ']' + echo 13772 + grep -i ' World Medical' + /usr/bin/curl -L --ntlm -k -v --user user:password http://99.99.99.99/pages/default.aspx -H Host:99.99.99.99 * About to connect() to 99.99.99.99 port 80 * Trying 99.99.99.99... connected * Connected to 99.99.99.99 (99.99.99.99) port 80 * Server auth using NTLM with user 'user' > GET /pages/default.aspx HTTP/1.1 > Authorization: NTLM TlRMTVNTUAABAAAAAgIAAAAAAAAgAAAAAAAAACAAAAA= > User-Agent: curl/7.15.3 (i686-redhat-linux-gnu) libcurl/7.15.3 OpenSSL/0.9.7l zlib/1.1.4 > Accept: */* > Host:99.99.99.99 > GET /pages/default.aspx HTTP/1.1 > Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEcAAAAYABgAXwAAAAAAAABAAAAABwAHAEAAAAAAAAAARwAAAAAAAAB3AAAAAYIAAGNib290aGWLUxkaU1rrL0i4vYr0eHzJLzzSzyLDDBcqTFU4HwbKMj9sGqOObdWUO8bk4ihGV48= > User-Agent: curl/7.15.3 (i686-redhat-linux-gnu) libcurl/7.15.3 OpenSSL/0.9.7l zlib/1.1.4 > Accept: */* > Host:99.99.99.99 > 0 1539 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0< HTTP/1.1 200 OK < Date: Fri, 03 Sep 2010 21:33:49 GMT < Server: Microsoft-IIS/6.0 < X-Powered-By: ASP.NET < MicrosoftSharePointTeamServices: 12.0.0.6420 < X-AspNet-Version: 2.0.50727 < Set-Cookie: WSS_KeepSessionAuthenticated=80; path=/ < Set-Cookie: http%3A%2F%2F10%2E9%2E0%2E141%2FDiscovery=WorkspaceSiteName=SG9tZQ==&WorkspaceSiteUrl=aHR0cDovLzEwLjkuMC4xNDE=&WorkspaceSiteTime=MjAxMC0wOS0wM1QyMTozMzo0OQ==; expires=Sun, 03-Oct-2010 21:33:49 GMT; path=/_vti_bin/Discovery.asmx < Cache-Control: private, max-age=0 < Expires: Thu, 19 Aug 2010 21:33:46 GMT < Last-Modified: Fri, 03 Sep 2010 21:33:46 GMT < Content-Type: text/html; charset=utf-8 < Content-Length: 112016 100 109k 100 109k 0 0 42563 0 0:00:02 0:00:02 --:--:-- 69402* Connection 0 to host 99.99.99.99 left intact * Closing connection 0 + '[' 0 -eq 0 ']' + echo UP UP + rm -f /var/run/sharepoint._.pid + exit [admin@xxxxx:Standby] monitors

 

  • Problem solved. I had set the health monitor up as a scripted type. I needed to set it up as external program. Works great now. Thanks Kareem!

     

     

    As it is now, I need to make a unique script for every node. Can anyone suggest how to generalize the script to work for any node it is applied to?

     

     

    Regarding NTLM authentication, is there a way to encrypt the password in the script?

     

     

    Thanks,

     

    Chris