Forum Discussion
Any iRules out there for a dummy pool member?
Is there anyone out there who has possibly written a series of irules to emulate a faulty http client? I think it could be really handy to have a pool member pull apart a query string like "?delay=5&code=503&fail_rate=0.3" and respond accordingly to allow a really quick way to see what a monitor or other "normal" iRules would do when the pool member acts as requested?
I might look to write something similar to this if not, as I'd think that the time spent would be well worth it.
Thanks
Chris
- hooleylistCirrostratusHi Chris,
when HTTP_REQUEST { set data {Some data to send to the client. If you want to use variables in here, replace the curly braces with quotes.} Look for a URI starting with a forward slash and then 3 digits (the first digit being 1-5) If one is found, set it as the HTTP response code. Else, send back an HTTP 200 if {[string match {/[1-5][0-9][0-9]*} [HTTP::path]]}{ Send the response with the status code from the requested path and data HTTP::respond [string range [HTTP::path] 1 3] content $data "a_header_name" "a_header_value" log local0. "Sending [string range [HTTP::path] 1 3] response with $data" } else { Send a 200 response with data HTTP::respond 200 content $data "a_header_name" "a_header_value" log local0. "Sending default 200 response with $data" } }
- Chris_PhillipsNimbostratusI got something working for a number of scenarios, but of course there's no way to prevent a client connection this way if everything comes in at http level. I'd like to be able to force an LB_FAILED but I think that's got to be impossible within an iRule alone.
- hooleylistCirrostratusTo trigger LB_FAILED, you could set a destination IP which doesn't answer arp using the node command.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com