For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

mchesney_162137's avatar
mchesney_162137
Icon for Nimbostratus rankNimbostratus
Jun 26, 2014

Modifying Pool Member Health Checks via API Requests

Hello, I have a number of health checks validating service pools are returning an expected response based on a page each service serves up. For the sake of this discussion, let's say I call "[pool member a]:[port]/status" and the page prints "GOOD". I want to use an API call to modify the health checks on what they validate. Say the page result is changed to "OK" based on a new release... I want a script that can, through the F5 API, update all the appropriate health checks (by name, or by pool) to validate on "OK".

 

Psuedo code:

 

update [pool member]:[port] health check, change content match to "OK"

 

4 Replies

  • There are multiple ways of doing this, and people with different skills. Which client OS would you use (Windows/Linux)? Which method is preferred, iControl or iControlREST? Which scripting language is preferred (ie Powershell, Python, Perl)? /Patrik
  • Hi Patrick, thanks for your prompt response. I use Chef (Ruby-based) for automation in a predominantly Linux environment. So if I can make the API call through our Chef deployment script that would be absolutely wonderful. I found two links in the iControl docs (https://devcentral.f5.com/s/articles/perl-set-monitor-property, and https://devcentral.f5.com/s/articles/perl-set-monitor-property) since posting this question.
  • I've done quite alot of scripting with Powershell but I'm afraid I am lacking experience in Ruby. However, if I were to do this I'd look into this method:

     

    https://devcentral.f5.com/wiki/iControl.LocalLB__Monitor__set_template_string_property.ashx

     

    set_template_string_property( in String [] template_names, in LocalLB__Monitor__StringValue [] values );

     

    Note how everything is defined as arrays and how the stringvalue is a type of it's own which in turn has another type as a member:

     

    • https://devcentral.f5.com/wiki/iControl.LocalLB__Monitor__StringValue.ashx
    • https://devcentral.f5.com/wiki/iControl.LocalLB__Monitor__StrPropertyType.ashx

    The purpose of the arrays is to be able to update multiple monitors at a time, just like you want. I really recommend trying to get that to work if you have many pools. Depending on the number of pools and the latency+bandwidth you have to your LTM it might save you alot of time.

     

    Sorry that I could not give you Ruby specific advice. Hope that helped though!

     

    /Patrik

     

  • If I may add, you should also be able to use something like Chef::REST to make an iControl REST call. Here's what the REST call would like from cURL:

    curl -sk -u 'admin:admin' -H "Content-Type: application/json" -X PUT https://x.x.x.x/mgmt/tm/ltm/monitor/http/http-test-ok-monitor -d '{"recv":"FOO"}'