Forum Discussion
ML_108504
Nimbostratus
Apr 13, 2009iRule Editor can't find default_pool
Hi folks, I'm experimenting with some simple iRules (I thought) from devcentral examples. When I check the following iRule in the Editor it complains with:
line 5: [can't find pool] [pool default_pool]
I assumed that the 'default_pool' string corresponded to, effectively, a variable representing the default pool for the virtual running the iRule. I want to write this iRule once and apply it to dozens of virtuals, obviously I don't want an individual iRule for each pool, what am I missing? (Hopefully something simple and obvious).
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } {
pool p_PUB_botfarm
} else {
pool default_pool
}
}
Save the noob! (thank you)
- lmwf1_55268
Nimbostratus
If you have not created the actual pool names in web based gui, then it will complaint. - dennypayne
Employee
While there is no "default pool" variable, if you don't specify a pool in the rule, then it will "fall out" to the default pool that is configured on the virtual server.when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } }
- hoolio
Cirrostratus
You can get the default pool configured on the VIP using LB::server pool. You'll want to do this before the pool has been selected on the TCP connection, so run LB::server in CLIENT_ACCEPTED:when CLIENT_ACCEPTED { Save the name of the default pool set default_pool [LB::server pool] } when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } else { pool $default_pool } }
- ML_108504
Nimbostratus
Posted By dennypayne on 04/14/2009 8:41 AM
when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } }
- ML_108504
Nimbostratus
Posted By hoolio on 04/14/2009 8:50 AM
when CLIENT_ACCEPTED { Save the name of the default pool set default_pool [LB::server pool] } when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } else { pool $default_pool } }
when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } else { pool $default_pool } }
- Craig_Jackson_2
Nimbostratus
Thanks for the info about saving the default pool in the CLIENT_ACCEPTED event. - dennypayne
Employee
[LB::server pool] is valid in the HTTP_REQUEST event as well, according to the wiki. Click here - ML_108504
Nimbostratus
Thanks for the tips and discussion guys, here's what I've ended up with at the moment, it passes the syntax checker at least ..when CLIENT_ACCEPTED { set default_pool [LB::server pool] } when HTTP_REQUEST { if { [active_members p_PUB_botfarm] < 1 } { event disable } elseif { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } else { pool $default_pool } }
- ML_108504
Nimbostratus
Actually, I'd like to use this one more, as I don't need to worry about health monitoring the default pool from the iRule, and don't need the default_pool variable.when HTTP_REQUEST { if { [active_members p_PUB_botfarm] < 1 } { event disable } elseif { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { pool p_PUB_botfarm } else { event disable } }
- dennypayne
Employee
Posted By mlameyer on 04/14/2009 5:04 PM
when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::header User-Agent]] contains $::bots] } { if { [active_members p_PUB_botfarm] > 0 } { pool p_PUB_botfarm } else { return } } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects