Forum Discussion
Vasile_Balan_95
Nimbostratus
Oct 11, 2006node selection string from v 4.x to v 9.x
Hi,
I need help with converting the node selection string
node(findstr(http_uri, "?ip=", 4, '/') + ":80")
from the persistence tab on v 4.x to v 9.x. i know there is no selection in v 9.x, so i guees an iRule should be written. i have a problem with the last statement that would use the node provided in ?ip=.
Thanks,
Vasile
3 Replies
- Deb_Allen_18Historic F5 AccountHi Vasile -
Something like this should work in 9.2 (replacing POOL with the name of the default pool):when HTTP_REQUEST { set myNode [findstr [string tolower [HTTP::uri]] "?ip=" 4 "/"] if { ($myNodeIP ne "") and ([LB::status pool POOL member $myNodeIP 80] ne "down") } { pool POOL $myNodeIP 80 } }
For the condition using LB::status, you will need to be running at least 9.2. In older 9.x versions, you can instead add an LB_FAILED event to catch that condition and load balance in the default pool instead:when HTTP_REQUEST { set myNode [findstr [string tolower [HTTP::uri]] "?ip=" 4 "/"] if { $myNodeIP ne "" } { pool POOL $myNodeIP 80 } } when LB_FAILED { LB::reselect }
HTH
/deb - Vasile_Balan_95
Nimbostratus
Hi deb,
i have 9.1.2 installed. i've tried to use the following:
when HTTP_REQUEST {
set myNode [findstr [string tolower [HTTP::uri]] "?ip=" 4 "/"]
if { $myNodeIP ne "" } {
pool POOL $myNodeIP 80
}
but it doesn't work.
thanks,
vasile - hoolio
Cirrostratus
Hello Vasile,
It would be helpful to get more detail on what wasn't working and what errors you saw. You could provide any relevant errors from /var/log/ltm using the current rule, or add log statements to the rule to get additional debug information.
I believe there are a couple of minor typos in the rule which may have prevented it from working as expected. There was a missing close parenthesis and myNodeIP was originally set as myNode. Try this and see what the results are:when HTTP_REQUEST { log local0. "starting..." set myNodeIP [findstr [string tolower [HTTP::uri]] "?ip=" 4 "/"] if { $myNodeIP ne "" } { log local0. "myNodeIP: $myNodeIP" pool http_pool $myNodeIP 80 } else { log local0. "myNodeIP was empty: (myNodeIP: $myNodeIP)" } } when LB_FAILED { log local0. "LB failed!" 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
