Forum Discussion
Reverse health monitor not working
Thanks for pointing me to the prospect of an external health monitor. With some learning and testing, I was able to accomplish my goal. I used the sample code in this article.
Note that with LTM 11.x and higher, you create an external monitor differently than before. This article details the methods pre and post v11.
I only had to make changes in 2 areas:
Send the request request and check the response nc $IP $PORT | grep "my receive string" 2>&1 > /dev/null
I changed the "my receive string" to the text the server returns. (The above line, for the folks who may be new to scripting and/or shell scripting, is the real heart of this script. It uses netcat (nc) to make a connection to the server's IP and port and look for a response. Note that you dont' change the $IP and $PORT text because those are variables which the script gets from the monitor configuration object. You can run NC from the LTM command line to see what it does.)
Apparently with an External monitor, there is no "reverse" option. To compensate for this, I changed this line:
if [ $? -eq 0 ]
to this:
if [ $? -ne 0 ]
This changes "equals" to "not equals", so that if the script does find the expected string, then the health check fails. This gives the same effect as the reverse option. (This above line is the core element that determines if the health check fails or not. It's checking if the nc command returns a success (an error code "0", or yes/affirmative).
So, thanks again for the assistance with this.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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