Forum Discussion

Paul_Gaynor_706's avatar
Paul_Gaynor_706
Icon for Nimbostratus rankNimbostratus
Jan 16, 2009

IRule causes Virtual Servers to be "up"?

Hi Everyone,

When I replace the first iRule below with the second iRule belown on a virtual server the VS is marked up when the server pool has no available members? Any idea what might be going on here?

First iRule

 
 when HTTP_REQUEST { 
   set uri [string tolower [HTTP::uri]] 
   if {$uri starts_with "/services"} 
    {} 
   else 
    { 
    HTTP::redirect https://[HTTP::host][HTTP::uri] 
    } 
 } 
 

Replacement iRule

 
 when HTTP_REQUEST { 
 if { [string tolower [HTTP::uri]] starts_with "/services" } { 
 pool ws_server_pool 
 } 
 elseif { [string tolower [HTTP::uri]] equals "/public/diagnostic.do"} 
 { 
 pool gs_server_pool 
 } 
 else { 
 HTTP::redirect https://[HTTP::host][HTTP::uri] 
 } 
 } 
 

Thanks!

Paul

4 Replies

  • I believe that the virtual will inherit any monitoring state of a pool referenced in an iRule. Your previous rule didn't contain a pool - thus it had no monitoring associated with it. Your new rule references 2 pools. It would only take 1 pool member among both pools to make the virtual "up". You can test this by marking all pools down and looking at the corresponding virtual status. I seem to also remember that if there are no monitors on the pools referenced within the irule - then the virtual where that irule applied with always be up. I'd personally love some confirmation on that, but that is at least the behavior that I've observed.
  • i confirm what wolfpack said. Status of pool within the iRule will impact the VS status.
  • Yeah, i verified that taking down the nodes in the pools that are referenced in the iRule does change the status of the VS.

     

     

    Is this good behavior?

     

     

    I would expect the primary pool as a resource of the VS to be the determining factor for the VS being up/down or the requirement that all referenced pools in the iRules have to be available for the VS to be available, not just one pool.

     

     

    I have verified that a GTM which monitors the LTM still sees the servers as unavailable even though the LTM has the VSs marked as up.

     

     

    Thanks for the replies

     

    -Paul
  • I have found a "trick" to get around this behavior. If you set the pool name as a variable and then call the variable in the pool statement, the iRule doesn't seem to "know" about status anymore. I had a similar problem with this rule:

     
     when HTTP_REQUEST { 
      If the QA cookie exists, go to the QA pool. 
     if { [HTTP::cookie exists "QAPilot"] } { 
     pool WWW-QA 
     } 
     else 
     { 
     pool WWW-GLOB 
     } 
     } 
     when LB_FAILED { 
         LB::reselect pool WWW-GLOB 
     } 
     

    However, we needed the VS to fail if WWW-GLOB was down, even if WWW-QA was up (due to OSPF route advertisement). Doing this fixed the problem (since WWW-GLOB was set as the default pool, if the "if" doesn't fire it will fall out to that):

     
     when HTTP_REQUEST { 
      If the QA cookie exists, go to the QA pool. 
     if { [HTTP::cookie exists "QAPilot"] } { 
     set lb_pool "WWW-QA" 
     } 
     else 
     { 
     set lb_pool "WWW-GLOB" 
     } 
     pool $lb_pool 
     } 
      
      If load balancing fails to the QA pool, load balance to the PROD pool. 
     when LB_FAILED { 
         LB::reselect pool WWW-GLOB 
     } 
     

    Denny