Forum Discussion

ERLomboy_27803's avatar
ERLomboy_27803
Icon for Nimbostratus rankNimbostratus
Feb 13, 2014

Health check via URL

Hi,

 

Wanted to setup a load balancer which can check the health of a node based on the URL (not by pinging just host and port).

 

For example: The LB should check the following URLs and if the HTTP response is 200 (OK) and the response text contains keyword as “PASS” then that particular node is good otherwise don’t send any request to that node. https://mysite.com:22301/ws/healthmonitor https://mysiteb:22301/ws/healthmonitor

 

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    ltm monitor http /Common/ws-healthmonitor_HTTP1.1_200-OK_http {
        defaults-from /Common/http
        description "Custom monitor - requests resource from specific sub folder."
        destination *:*
        interval 5
        recv "HTTP/1.(0|1) 200 OK"
        send "HEAD /ws/healthmonitor HTTP/1.1\\r\\nHost:\\r\\n\\r\\n"
        time-until-up 0
        timeout 16
    }
    

    Note that I haven't specified the port as the pool already specifies it (I prefer to keep monitors as generic as possible).

    To check for the string "PASS" I would create a second monitor. It's possible to use a single one, but it makes troubleshooting more difficult (e.g. if there's a 200 but not "PASS").

  •  

    Hi - I got the text above when hitting the URL for one of the pool member. So I change the receeve string to INIT but it's still not showing us UP. Please help!

     

  • Hi,

     

    Kindly please use the below Send String & Receive String it will work.

     

    Send : GET / HTTP/1.1\r\nHost:\r\nConnection: Close\r\n\r\n

     

    Receive : HTTP/1.1 *(200|301|302|304)

     

    • ERLomboy_27803's avatar
      ERLomboy_27803
      Icon for Nimbostratus rankNimbostratus
      Hi Mohammed - Do I need to update the Host entry with the appropriate server name or not needed?
    • ERLomboy_27803's avatar
      ERLomboy_27803
      Icon for Nimbostratus rankNimbostratus
      Yep - Pool is already created. I did try to add it and the nodes are still Active. Not sure how I can validate or it's already validated working when the nodes are UP?
  • Sorry for late reply kindly please check with your server own to generate the wrong url to access from the client side you need to get the code 500 then it will move on to the second pool member. i hope you understand.