LB::server pool

Hi

I’ve this iRule running in two different boxes:

rule iRule_Sorry_Redirect {

when LB_FAILED {

if { [active_members [LB::server pool]] < 1 } {

HTTP::fallback “http://sorry-[HTTP::header host]”

}

}

}

On 6800 9.4.8 HF4 box is set up for 27 Virtuals without any problem at the /var/log/ltm. And the statistics says:

RULE iRule_Sorry_Redirect

±> LB_FAILED 5042 total 0 fail 0 abort

But on the 6900 also 9.4.8 HF4 is only set up for 1 Virtual with this continous message at the log file:

Nov 19 08:47:18 tmm1 tmm1[2141]: 01220001:3: TCL error: iRule_Sorry_Redirect - no such pool Failed Tcl_pool_GetFromObj: pool (line 1) invoked from within “active_members [LB::server pool]”

RULE iRule_Sorry_Redirect

±> LB_FAILED 269 total 269 fail 0 abort

It could be related with the CMP feature? On BIG-IP 6800 boxes CMP is not supported meanwhile on BigIP 6900 is working with this feature by default. I can read this from the 9.4.8 Release Notes:

Global variable in iRule and CMP (CR93820)

In this release, if an iRule containing a global variable is removed from a virtual server, the virtual server is eligible for full Clustered Multi-Processing (CMP), rather than remaining relegated to a single Traffic Management Microkernel (TMM).

So am I using a Global variable at my iRule ¿? any idea about my problem ¿?

Thanks in advanced.

I’d start off by logging.

rule iRule_Sorry_Redirect {
   when LB_FAILED {
   log local0. "Pool was [LB::server pool]"
  if { [active_members [LB::server pool]] < 1 } {
    HTTP::fallback "http://sorry-[HTTP::header host]"
         }
}
}

That'll log to the LTM logs. You aren't using any variables in your rule.

As I think about this more, I don’t understand how LB::server pool can be used from LB_FAILED even though the wiki page says it can be. Let’s see the value you log I guess…

Yeah, I’m not sure whether LB::server pool would return the VS default pool in LB_FAILED. If it doesn’t, you could save the name of the pool in CLIENT_ACCEPTED and then reference that variable in LB_FAILED. Similarly, I don’t know if HTTP::host would be available then either.

when CLIENT_ACCEPTED {
   set default_pool [LB::server pool]
}
when HTTP_REQUEST {
   if {[HTTP::host] eq ""}{
      set host [IP::local_addr]
   } else {
      set host [HTTP::host]
   }
}
when LB_FAILED {
   if { [active_members $default_pool] < 1 } {
      HTTP::fallback "http://sorry-$host"
   }
}

Aaron

Thank you people!!!

I’ve been some days out of the office and I didn’t check the answers… as soon as I can I’ll try your advices…

Thanks again!

Hi

I had time to test…

$default_pool is always pool_ni.cm.es_80 which is the default pool of the virtual server. So, I should use the event CLIENT_ACCEPTED to be sure that iRule manages the correct pool it a great idea.

I’m going to set up on the production enviroment this iRule:

rule Sorry-Redirect {

when CLIENT_ACCEPTED {

set default_pool [LB::server pool]

}

when LB_FAILED {

if { [active_members [LB::server pool]] < 1 } {

HTTP::fallback “http://sorry-[HTTP::header host]”

}

}

I’ve tried on the pre-production enviroment but I need load to be sure that works right.

Hi !

It seems to be working right:

:Active] ~ b rule iRule_Sorry_Redirect list

rule iRule_Sorry_Redirect {

when CLIENT_ACCEPTED {

set default_pool [LB::server pool]

}

when LB_FAILED {

if { [active_members $default_pool] < 1 } {

HTTP::fallback “http://sorry-[HTTP::header host]”

}

}

}

Active] ~ b rule iRule_Sorry_Redirect

RULE iRule_Sorry_Redirect

±> CLIENT_ACCEPTED 7667 total 0 fail 0 abort

±> LB_FAILED 5 total 0 fail 0 abort

Hi Angel,

Thanks for posting the results of your testing. Glad the last version is working for you.

Aaron

Aaron -should CLIENT_ACCEPTED be added to the events from which LB::server pool can be called? The wiki page doesn’t list it.

http://devcentral.f5.com/wiki/default.aspx/iRules/LB\_\_server.html

It’s there third to last in the list.

Aaron