Forum Discussion

KJ_50941's avatar
KJ_50941
Icon for Nimbostratus rankNimbostratus
Mar 14, 2013

irule base on status code[200,400] mark server down

I have requirement to write irule to take action base on status code recived from server. for example if http_status_code not 200,400, then mark server down and if status code is 300 mark it back up?

 

 

what is the irule for this work. Thx in advanced.

 

 

 

2 Replies

  • Hi KJ,

     

     

    The problem with marking a node down with an iRule is that if it passes the Monitor assigned to the pool then it will be marked back up (unless you have Manual Resume Enabled).

     

     

    I would suggest using a custom HTTP Monitor.

     

     

    Send String: "GET /something.html\r\n\r\n"

     

    Receive String (Good Indicator): "HTTP/1\.(0|1) (2|3|4)"

     

    Receive String Disable (Disable if Status Code equals any 5xx Errors): "HTTP/1\.(0|1) (5)"

     

     

    So this will consider any 2xx, 3xx, or 4xx Status Codes to be good and any 5xx Errors Bad and mark the node down.

     

     

    Keep in mind that you can apply any number of HTTP Monitors to a Pool or Node and require that all of them be good in order for a node to be available to take traffic.

     

     

    Hope this helps.
  • Thx, for quick reply. I need to thini about their requirements and get back to you as soon as possible.