Forum Discussion

rpalacios_79340's avatar
rpalacios_79340
Icon for Altostratus rankAltostratus
Nov 30, 2010

iRules for monitoring pool members

Hello guys,

 

 

Here's the challenge that I have at the moment. I need to trigger a service re-select if a web server is no longer listening two ports. The configured health monitor for the pool at the moment is icmp. This is good for when the server goes offline but will not do anything if the application halts.

 

 

 

Does anyone have an iRule I can use to mark the pool member down and trigger a service re-select if the F5 can no longer send traffic to the application ports?

 

 

 

Thanks in advance,

 

 

 

rp

 

 

 

6 Replies

  • Hi RP,

    You should be able to implement this logic by applying two monitors with the destination port configured. Here's an example which creates a dependency on port 80 and port 8080 for each pool member:

    
    monitor http_8080 {
       defaults from http
       dest *:8080
       recv "200 OK"
       send "GET / HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n"
    }
    monitor http_80 {
       defaults from http
       dest *:80
       recv "200 OK"
       send "GET / HTTP/1.1\r\nHost: \r\nConnection: Close\r\n\r\n"
    }
    

    You could then set the pool's service on action down to reselect.

    Aaron
  • Hello Aaron,

     

     

    Thank you for the prompt reply. The ports in question are 9122 and 8165, they are for a web service application. How can I modify the irules you provided to monitor these?

     

     

     

    Thanks!

     

     

     

    -rp

     

     

     

     

     

     

  • Hi RP,

     

     

    Just to clarify, these are monitors, not iRules. You'd define them in the GUI under Local Traffic >> Monitors. You can specify an alias port of 9122 on one custom monitor and 8065 on the other. Make sure to customize the send and receive strings for both to valid requests/response strings for the application. Then add both monitors to the pool under the pool properties tab. Then set the 'Action On Service Down' to Reselect.

     

     

    Aaron
  • Hi Aaron,

     

     

    Understood.

     

     

     

    How do I determine the send string and receive string? Is this through sniffing, packet capturing or http header lookup?

     

     

     

    Thanks,

     

     

     

    -rp

     

  • You could use a browser plugin like Fiddler or HttpFox for Firefox and make a request to the application. Or if it's a webservice, capturing a tcpdump would work. Try to find a request which tests the functionality of the service without doing something that is too computationally expensive for the applications. If you want help configuring the monitor strings once you have sample requests, post sanitized copies of the requests and responses.

     

     

    Also, can you confirm which LTM version you're running? The monitor send string processing has changed slightly over the versions. Here are two related solutions on this:

     

     

    SOL10655: Change in Behavior: CR/LF characters appended to the HTTP monitor Send string

     

    http://support.f5.com/kb/en-us/solutions/public/10000/600/sol10655.html

     

     

    SOL2167: Constructing HTTP requests for use with the HTTP or HTTPS application health monitor

     

    http://support.f5.com/kb/en-us/solutions/public/2000/100/sol2167.html

     

     

    Aaron
  • Hello Aaron,

     

     

    I have dowloaded httpfox and was able to capture the header info. I created a TCP and HTTP monitor using this info and added it to a member, the member was marked down soon after that. Can you confirm I'm looking at the right information?

     

     

     

    BTW - We are running on version 9.4.6, however I am planning to upgraded the redundant pair to ver 10.x.

     

     

     

    I'm attaching a word doc w/ some screenshots.

     

     

     

    Thanks!