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

Parveez_70209's avatar
Parveez_70209
Icon for Nimbostratus rankNimbostratus
May 29, 2014

Irule to Make a Member-server down based on error: 503

Hi Team,

Need your earnest suggestion into the below.

1.Lets say we got 4 member-servers binded into a Pool, and based on the request towards any member-server( lets say we are using least connections to load-share between the member-servers),incase we get 500 error while reaching the member-server,we want to mark the member-server down,and move to next member-server, and will try 15 tries and if there also get 500 error, it will disable that too or incase all the member-servers down, it will point to maintenance-page served by member-server 1.1.1.1( Maintenance Node) and xyz.com_http is the Pool name.

Can something will the below concept work ?

when HTTP_RESPONSE priority 800 { if { [HTTP::status] eq 503 && $count < 15 } { incr count HTTP::retry $request

log local0. "retry xyz.com_http"
            } elseif { [HTTP::status] == 503 && $count ==       15 } {         
    node 1.1.1.1
}

}

Thanks and Regards Parveez

7 Replies

  • Rather than using an iRule, it may be easier to just use an http monitor and set a receive string that reflects the health of the application. Any server not responding with the expected receive string (e.g. "200 OK") could be marked down.

     

    For a maintenance page, you could either specify a fallback host on the HTTP profile applied to your virtual server, or use an iRule:

     

    https://devcentral.f5.com/questions/maintenance-page-irule

     

  • Ok, thanks.

     

    One more thing, need to create one advanced monitor where we need to edit a receive string which will track 503 error which will mark the member-server down.

     

    Thanks and Regards Parveez

     

  • You can additionally specify a receive disable string something like "503". The monitor will disable the member if it catches the receive disable string and will mark the member down if it doesn't catch the receive string. Just specifying a receive string should account for your situation though where you want to mark the member down if you aren't receiving a 200.

     

    http://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/ltm_monitors_reference_11_0_0/2.html

     

    Check 'Creating a Custom HTTP Monitor', steps 11-13.

     

  • Hi Cory,

     

    I tried going through 'Creating a Custom HTTP Monitor' but struck into this.

     

    Idea is to catch all the 500.* means( any version error related t0 500 from server) which we wanted to put into the receive string, what will be the syntax into the receive string:

     

    Kindly guide.

     

    Thanks and Regards Parveez

     

  • It may be best to focus your send string based on a successful monitor attempt. Ideally you want the send string to get something reflective of the actual health of the server/application.

     

    If the application is healthy, then you can use curl to run a query against it to see how it responds. Then build your send string around that response. This ensures that if the server returns anything other than what's expected (whether it's a 503 or whatever), then the health of that server is appropriately reflected by LTM. If you are only matching on a 500 level code, then you may not be properly reflecting the health of the server/application.

     

  • Hi Cory,

    Got you, but basically application is designed in such a manner that it will send response back in some version of 500.* only,( basically if we monitor 500 that will be the best as it will cover 503 too )

    so that's the reason we are looking more into the receive string which will monitor that and make the member-server down. Alongwith that, we are planning to add a fallback host which will consist the apology member-server. And alongwith all these, we are using the Below irule:

    And also we are having the below Irule in place:

    Don't send 503 or 500 errors out, try next server. After 10 consecutive failed attempts, send redirect

    when HTTP_REQUEST priority 700 { set my_url [HTTP::host][HTTP::uri] }

    when HTTP_RESPONSE priority 700 { if { ( ( [HTTP::status] == 500 ) or ( [HTTP::status] == 503 ) ) && ( $count < 15 ) } { incr count HTTP::respond 302 Location "http://$my_url" event disable } elseif { ( ( [HTTP::status] == 500 ) or ( [HTTP::status] == 503 ) ) && ( $count == 15 ) } { set count 0

    log local0. "Sending to Main Page"
        HTTP::respond 302 Location "http://www.xyz.com"
        event disable
    }
    

    }

    Thanks and Regards