Forum Discussion

veredgfbll's avatar
Mar 01, 2023

create an external monitor with curl to all nodes with different host names

Hi, 

 

I would like help with the following scenario.

We have a pool that consists of 10 servers. I need a monitor to check the existence of favicon.ico on each of them.

The catch - I need to use individual host names. I can do this when creating a node monitor for each member.

The following works OK on an HTTPS member specific monitor:

Get /favicon.ico http/1.1\r\n Host:server1.domain.com \r\nconnection:close \r\n\r\n

receive string 200 ok

But we would really like a single monitor for the whole pool and so I tried a few external monitors (curl monitor) but nothing seems to work. 

When I test curl to the server IP (i.e. curl -k https://x.x.x.x/favicon.ico) I don't get a 200 ok response. instead I get a long binary sequence which I believe represents the ico file. I tried using sections from this binary as the RECV parameter value but this didn't. I tried using 200 ok for the RECV and still the pool was down. If I only leave the URI as favicon.ico without using RECV parameter, the pool is green but if you shut down a server there is no effect and it will appear green (the member will remain green).

I have tried using a script that alternates between host names like here:

 

case "$Node" in
"1.2.3.4")
HOST="host1.domain.com"
;;
"5.6.7.8")
HOST="host2.domian.com"
;;

 

But it didn't changen anything

Could anybody help with this issue?

Thanks,

Vered

 

  • veredgfbll In order to come up with a solution for you it would be helpful to know the reasoning why a unique hostname is required per server for this health monitor. Typicall if you have more than one pool member in a pool with each pool member being a unique server they would load balance traffic for lets say www.example.com which should exist on every pool member. In this case your file of "/favicon.ico" should exist in the directory for www.example.com so that your health monitor could use the following to cover all pool members with a single monitor.

    Send String: HEAD /favicon.ico HTTP/1.1\r\nHost: www.example.com\r\nConnection: Close\r\n
    Receive String: HTTP/1\.1 200 OK

    The reason this is a HEAD rather than a GET is because you are only interested in the HTTP head status code section so no reason to gather the body of the path that you are querying. If you require a health check to the hostname of the server as well as the main host that you are serving traffic for this seems a bit redundant because you can make that "/favicon.ico" available in the www.example.com directory. Now you could achieve this with 11 health monitors, one for each pool member and then one for www.example.com but this weeks a bit redundant and over complicated when you can make the "/favicon.ico" available in the www.example.com directory and solve all the issues in one health monitor.

    If you must perform an external health monitor the following article should help you construct the external health monitor.

    https://community.f5.com/t5/technical-articles/ltm-external-monitors-the-basics/ta-p/277128

  • veredgfbll In order to come up with a solution for you it would be helpful to know the reasoning why a unique hostname is required per server for this health monitor. Typicall if you have more than one pool member in a pool with each pool member being a unique server they would load balance traffic for lets say www.example.com which should exist on every pool member. In this case your file of "/favicon.ico" should exist in the directory for www.example.com so that your health monitor could use the following to cover all pool members with a single monitor.

    Send String: HEAD /favicon.ico HTTP/1.1\r\nHost: www.example.com\r\nConnection: Close\r\n
    Receive String: HTTP/1\.1 200 OK

    The reason this is a HEAD rather than a GET is because you are only interested in the HTTP head status code section so no reason to gather the body of the path that you are querying. If you require a health check to the hostname of the server as well as the main host that you are serving traffic for this seems a bit redundant because you can make that "/favicon.ico" available in the www.example.com directory. Now you could achieve this with 11 health monitors, one for each pool member and then one for www.example.com but this weeks a bit redundant and over complicated when you can make the "/favicon.ico" available in the www.example.com directory and solve all the issues in one health monitor.

    If you must perform an external health monitor the following article should help you construct the external health monitor.

    https://community.f5.com/t5/technical-articles/ltm-external-monitors-the-basics/ta-p/277128

  • Can you share the complete script? And please try to enable and check the log of the external monitor in /var/log/monitors/<name>.