External Health monitor
Hi,
I need some assistance creating shell script for use in a external health monitor. I do to have much experience in creating scripts so if someone could either assist or point me to a good reference that would be a start.
We are running an internal app that utilizes msql (proprietary sql language) and I want to create a script that can be called and depending upon the outcome will the service show up or down.
echo "remote("") {list library version}" | msql -utgbmin -wtacb201112 -S ?s
The service should be marked up if Executing... Success! is shown and it should be marked down if Executing... Error! is shown. I have opened a ticket with websupport and they do not assist with this type of request is all I received back!
Your help is appreciated.
Thanks, Megan
Hi Megan,
LTM health monitors run on you BigIP and communicate with remote services over the network. What you have provided looks like something which runs on a remote box. To be able to use the output from that command to mark a service up or down, you need to get the output to your BigIP. Two solutions come to mind:
-
On the msql host, create a file with your commands in it, eg mytest. Then create a listener with netcat to run it when it receives a connection from the network
while : ; do nc -vl -e mytest 1234; done
Now you can use a TCP monitor on the F5 which sends to port 1234 (in my example), and expects "Success" in the result. You will need to consider how to keep that process started and running on the msql box, and there are probably opportunities for DOS or other security issues.
-
Create the bash script on your msql box as before. On the F5, create an external monitor (plenty of examples on DevCentral) which uses ssh to execute this. This is more complicated (though is not hard to implement), uses more system resources on both the F5 and your msql box, but more secure, and I suspect more robust too.
Of course, I might have completely misunderstood your requirement, but I hope that helps.
-