Forum Discussion
rraver_79489
Nimbostratus
May 08, 2009External 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.
4 Replies
- The_Bhattman
Nimbostratus
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 - Yossi_Attia_100
Nimbostratus
Hey,
did you manage to use the UP response in order to correctly monitor it?
Thanks
Yosi - Tompa_93231
Nimbostratus
Try using lower case letters.
i.e: echo "up" - hoolio
Cirrostratus
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: http://tldp.org/LDP/abs/html/io-redirection.html
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects