Forum Discussion

duffyj0_45477's avatar
duffyj0_45477
Icon for Nimbostratus rankNimbostratus
Oct 20, 2010

SOAP Response New to F5 - iRules

Is there a way to have an iRule to check 2 nodes in a pool, and that if they are both down. send this SOAP response?

 

 

HTTP/1.1 200 OK

 

Cache-Control: private

 

Content-length: 610

 

Content-Type: application/soap+xml; charset=utf-8

 

Server: Microsoft-IIS/7.5

 

X-AspNet-Version: 4.0.30319

 

X-Powered-By: ASP.NET

 

 

http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. "

 

  • and use the LB::status command to check the pool member status: http://devcentral.f5.com/wiki/default.aspx/iRules/LB__status.html Click Here
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Duffy,

    You can use HTTP::respond to send an LTM generated HTTP response.

    http://devcentral.f5.com/wiki/default.aspx/iRules/http__respond

    Here is an example:

    HTTP::respond 200 content {http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. " } noserver Cache-Control private Content-Type {application/soap+xml; charset=utf-8} Server {Microsoft-IIS/7.5}

    If you're on 9.4.1 or lower, you won't be able to use the noserver flag to suppress the LTM inserted "Server: BigIP" header in responses.

    To check if the pool has no active members, you can use active_members:

    
    when HTTP_REQUEST {
       if {[active_members [LB::server pool]] == 0 }{
          HTTP::respond 200 content \
             {http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. " } \
             noserver \
             Cache-Control private \
             Content-Type {application/soap+xml; charset=utf-8} \
             Server {Microsoft-IIS/7.5}
       }
    }
    

    Aaron
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Posted By Jason Rahm on 10/20/2010 04:52 PM

     

    and use the LB::status command to check the pool member status: http://devcentral.f5.com/wiki/default.aspx/iRules/LB__status.html Click Here

     

    I wonder why we can't use LB::status "pool_name" to get the status of the pool as well as individual members... I think I'll ask for an RFE CR as it seems logical to me.

     

     

    Aaron

     

  • You can get this indirectly in GTM with the pools command, which returns a list or count of the pools in a particular color status. That might be a better namespace than LB::status as I take that to be a decision-based target of some sort, rather than a collection of targets. My $.02. Regardless of what it's called, that's a valuable bit of information and makes a lot of sense for enhancement.
  • Hi All,

    Thanks for your help so far originally I asked for this to be sent as the SOAP response.

    How do I get the following sint in the SOAP response?

     
    HTTP/1.1 200 OK

    Cache-Control: private

    Content-length: 610

    Content-Type: application/soap+xml; charset=utf-8

    Server: Microsoft-IIS/7.5

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

    http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. "
     
  • HTTP/1.1 200 OK

     

    Cache-Control: private

     

    Content-length: 610

     

    Content-Type: application/soap+xml; charset=utf-8

     

    Server: Microsoft-IIS/7.5

     

    X-AspNet-Version: 4.0.30319

     

    X-Powered-By: ASP.NET

     

     

     

     

     

    http://www.w3.org/2005/08/addressing/soap/fault

     

    urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1

     

     

     

     

     

    s:Sender

     

     

     

    The application is temporarily down for maintenance.

     

     

     

     

     

     

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Can you clarify your question? Can you also put the code you want to return inside the [ code ]

     

    Thanks, Aaron