Forum Discussion
Festus_50639
Nimbostratus
Dec 01, 2008"Select pool based on uri content" iRule doesn't seem to be working
Good morning,
I have an iRule that is designed to select a pool based on a string found in the uri and it doesn't seem to be working. I have a log that collects the uri for reference....
hoolio
Cirrostratus
Dec 03, 2008Hi Kevin,
LB::status should actually work in HTTP_REQUEST and LB_SELECTED. There were a few typos in your rule. LB::reselect was missing an 'e'. And there was a missing closing curly brace in HTTP_REQUEST and an extra one in LB_SELECTED. Also, I think you'll run into problems using a variable name with a hyphen:
% set test-var 10
10
% puts $test-var
can't read "test": no such variable
% puts ${test-var}
10
You could either reference the variable with curly braces or just change it to an underscore:
when HTTP_REQUEST {
pool $esb_8981_pool
set sel_node [LB::server name]
set front "esb_"
set back "_pool"
set svc_name [getfield $svc_uri "eProxy/service/" 2]
set svc_pool [concat $front$svc_name$back]
foreach line $::esb_svc_name_port_class {
if {[string match [getfield $line ":" 1] $svc_name] } {
set svc_name_port [getfield $line ":" 2]
}
}
}
when LB_SELECTED {
if { ([LB::status pool [LB::server pool] member [LB::server addr] [LB::server port]] eq "up")\
and ([LB::status pool $svc_pool member [LB::server addr] $svc_name_port] eq "up") } {
eval $sel_node
} else {
LB::reselect
}
}
Aaron
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