Forum Discussion

diana_24252's avatar
diana_24252
Icon for Nimbostratus rankNimbostratus
Apr 22, 2010

iRule with two IF statements is not working correctly

I have this iRule below and it does a good job on forwarding to pools POOL_PUB_MOSS and MyCampus_Pool, but not to the Offline_Pool when all servers are down or disabled. What do I need to change?

 

 

when HTTP_REQUEST {

 

if { [matchclass [HTTP::uri] starts_with $PRODMOSS] } {

 

if {[active_members POOL_PUB_MOSS] > 0 } {

 

pool POOL_PUB_MOSS

 

} else {

 

pool Offline_Pool

 

}

 

} else {

 

if {[active_members MyCampus_Pool] > 0 } {

 

pool MyCampus_Pool

 

} else {

 

pool Offline_Pool }

 

}

 

}

 

 

 

TY

2 Replies

  • The iRule looks okay. Can you try testing again with debug logging and then check /var/log/ltm for the output?

    when HTTP_REQUEST {
       log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::host][HTTP::uri]"
       if { [matchclass [HTTP::uri] starts_with $PRODMOSS] } {
          log local0. "[IP::client_addr]:[TCP::client_port]: Matched MOSS URI check"
          if {[active_members POOL_PUB_MOSS] > 0 } {
             log local0. "[IP::client_addr]:[TCP::client_port]: MOSS pool up, using it"
             pool POOL_PUB_MOSS
          } else {
             log local0. "[IP::client_addr]:[TCP::client_port]: MOSS pool down, using offline pool"
             pool Offline_Pool
          }
       } else {
          log local0. "[IP::client_addr]:[TCP::client_port]: No match for MOSS URI check"
          if {[active_members MyCampus_Pool] > 0 } {
             pool MyCampus_Pool
             log local0. "[IP::client_addr]:[TCP::client_port]: MyCampus pool up, using it"
          } else {
             log local0. "[IP::client_addr]:[TCP::client_port]: MyCampus pool down, using offline pool"
             pool Offline_Pool
          }
       }
    }
    when SERVER_CONNECTED {
       log local0. "[IP::client_addr]:[TCP::client_port]: Connected to [LB::server]"
    }

    Aaron

  • Thank you Aaron! I will try that the next maintenance window. I have one more question on the "active_members" parameter - is it the same if the servers are administratively disabled or do they have to be marked down by a monitor?

     

     

    Diana