Forum Discussion

Daniel_Ma_23954's avatar
Daniel_Ma_23954
Icon for Nimbostratus rankNimbostratus
Mar 21, 2016

F5 Health Monitors for Pools

I am looking for some help on the best way / practice for implementing the below:

 

I have developers asking to implement a new customized health check that would basically look for a .php script on each of the nodes in a certain location. The script would run a variety of checks and report back with a 200 or 500 response to the F5. Based on the response, the F5 would report the pool as available or offline.

 

I believe this should be doable, but I'm not familiar at how best to accomplish this.

 

Any guidance on this would be appreciated?

 

5 Replies

  • You can implement a custom http or https monitor that would perform a GET request, then you could examine the response.

     

    In order to create a custom monitor, you can navigate to Local Traffic >> Monitors, click Create. Enter the name for the monitor and select http/https for the type (depending on what you are planning on using). In the Send String field specify GET /locationOfThePhpScript/filename.php\r\n

     

    In the Receive String enter the string that the file will respond with. It might be easiest if guys implementing the script could respond with i.e. 200 OK or 500 NOK which you would then enter in this field. You could also enter a username and password if they are required. After you are done with setting this up, you can click Finished.

     

    Then navigate to the pool that you wish to monitor using this monitor. And specify the monitor that you have just created as an active monitor in Health Monitors section.

     

    Hope this helps.

     

  • Here's an update:

    The Send String I end up using seems to be working:

    GET /health.php HTTP/1.1\r\nHost: www.abc.com

    I'm just having issues with the Receive String, seeing errors in the log about "Response did not match recev regex yet"

    The Receive String that I have now, is a simple, HTTP1.1/ 200 OK string.

    But, the output of health.php has more information than that.

    HTTP/1.1 200 OK
    Server: nginx
    Date: Wed, 04 May 2016 03:00:20
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    X-Frame-Options: SAMEORIGIN
    

    Is there a way that I can match the response or just the first line of the response?