External health monitor works when ran from CLI but doesn't when applied to profile

I have the below health monitor that works when I run it in the command line, an UP statement gets put to the screen but doesn’t when I apply it to the profile. I have tried it with both the static IP and the variable IP.

IP=`echo ${1} | sed ‘s/::ffff://’`

IP=“10.2.3.10”

PORT=${2}

URI=“/acct/ping.jsp”

send request & look for expected respons

STATUS=$(curl -kINfs https://${IP}:${PORT}$URI | grep -i “200 OK”)

STATUS=$(curl -kINfs https://10.2.3.12:443/acct/ping.jsp | grep -i “200 OK”)

mark node up if response is HTTP STATUS 200

if [ “$STATUS”==“HTTP/1.1 200 OK” ]

then

echo “UP”

fi

any ideas or suggestions? It’s to check the page HTTP status code and verify that it’s code 200.

Why didn’t you choose to use the built-in http monitor. If you are looking for a status code then it can be easily obtained with that.

CB

Hey,

did you manage to use the UP response in order to correctly monitor it?

Thanks

Yosi

Try using lower case letters.

i.e: echo “up”

Any standard output from an external script will be interpreted as a positive response for the member state, so the case (or the content) of the “up” message shouldn’t matter.

It might help to log debug messages to a log file. Here are some quick notes for adding debug to a shell script with both standard error and standard out being redirected to the log file.

Based on info from: I/O Redirection

DEBUG=‘1’

LOGFILE=“/var/log/${0}.log”

If debug is enabled, log the date to a log file. Redirect standard error and out to the log file.

if [ ${DEBUG} -eq 1 ]; then echo “`date +”%Y-%m-%d %H:%M:%S"`: Debug enabled" >> ${LOGFILE} 2>&1; fi

Aaron