Forum Discussion

mininer_62033's avatar
mininer_62033
Icon for Nimbostratus rankNimbostratus
May 08, 2012

how to use iRule control traffic by http html content(GET result). Please give some advice.

Environment:

 

1. F5 LTM V10, Loadbalance for TOMCAT.

 

2. Can get server's performance parameter through url.

 

 

e.g.

 

 

We can get one number, from 1 to 100.

 

That's mean server's load percent.

 

 

 

This address can return a value: True or False.

 

That's mean the server should accept new connection or not.

 

 

Requirement and Question:

 

1. How to get html body value use iRule?

 

Which http:: command I should use?

 

 

2. we can use GET at http monitor, but just can enable or disable nodes.

 

Can we use monitor do more feature?

 

e.g.

 

If one node receive string( load percent) > 75

 

Then traffic -> other nodes

 

 

If one node receive string(acceptnewconnection) = false

 

Then traffic -> other nodes

 

 

I just iRule fresher, please give me some advice or example case.

 

 

thanks

 

2 Replies

  • Hi,

     

     

    You could potentially use a receive disable string on the HTTP monitor for this. What does the actual response look like for the two URIs? If you assume it's a key=value format, you could try something like this to mark the member down if the percentloaded value is 80-99:

     

     

    recv-disable "percentloaded=[8-9][0-9]"

     

     

    To look for the disabled value you could try:

     

     

    recv-disable "acceptnewconnection=false"

     

     

    sol12818: Using the Receive Disable String advanced configuration setting

     

    https://support.f5.com/kb/en-us/solutions/public/12000/800/sol12818.html

     

     

    Aaron
  • thanks for hoolio's reply. Now I can use monitor advance setting do what I want.

     

     

    And I still have one question:

     

    Can I use iRule GET URIs response every 1m? And then decide which node should take traffic.

     

     

    the URI response just like below:

     

    1. when we input

     

    GET /Action?getattribute=PercentLoaded HTTP/1.0\r\n

     

    response is : 95

     

    (maybe not 95, just a number)

     

     

    2. GET /Action?getattribute=AcceptNewCon nection HTTP/1.0\r\n

     

    response is : true

     

    (or 'false')