Forum Discussion
William_Benett1
Nimbostratus
Jul 11, 2007Node status problems
I have an iRule that uses LB::status to check the state of a node. Based on that, I then load balance to it or not. I'm running 9.3.0 and I've run into an issue where the node shows up green for TMM but LB::status returns "down". What's up with that?
Here's the rule. Support bounced me to DC. This rule performs load balancing for a very weird application.
when RULE_INIT {
array set ::session_table { }
set ::lbcurrent 0
set ::BSIFlowPort 49151
set ::BSIFhighPort 49250
set ::BSIFNODE1 "x.x.x.x"
set ::BSIFNODE2 "x.x.x.y"
}
when CLIENT_ACCEPTED {
set lport [TCP::local_port]
switch -glob [TCP::local_port] {
49* { if { $lport > $::BSIFlowPort && $::BSIFhighPort > $lport} {
if { ! [expr {$lport & 1}]} {
switch $::lbcurrent {
0 {
if { [LB::status node $::BSIFNODE1 up] == 0 } {
log local0. "chose node 2, node 1 status:\
[LB::status node $::BSIFNODE1]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE2
set ::lbcurrent 1
node $::BSIFNODE2
} else {
log local0. "chose node 1, node 1 status:\
[LB::status node $::BSIFNODE1]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE1
set ::lbcurrent 1
node $::BSIFNODE1
}
}
1 {
if { [LB::status node $::BSIFNODE2 up] == 0 } {
log local0. "chose node 1, node 2 status:\
[LB::status node $::BSIFNODE2]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE1
set ::lbcurrent 0
node $::BSIFNODE1
} else {
log local0. "chose node 2, node 2 status:\
[LB::status node $::BSIFNODE2]"
set tableentry "[IP::client_addr]:$lport"
set ::session_table($tableentry) $::BSIFNODE2
set ::lbcurrent 0
node $::BSIFNODE2
}
}
}
} else {
set evenport [ expr { $lport - 1} ]
set tableentry "[IP::client_addr]:$evenport"
if { $::session_table($tableentry) == "" } {
reject
} else {
log local0. "we got here with [TCP::local_port]"
node $::session_table($tableentry) $lport
}
}
}
}
default { discard }
}
}
when CLIENT_CLOSED {
if { ! [expr [TCP::local_port] &1]} {
set tableentry "[IP::client_addr]:[TCP::local_port]"
if { $::session_table($tableentry) == "" } {
unset $::session_table($tableentry)
}
}
}
- Deb_Allen_18Historic F5 AccountLet me do a little digging around & see what I can find out.
you might consider using 'ne "down"' instead of 'eq "up"' if you ever want to be able to drain off connections or test the rest of the rule logic without a monitor applied. That way the status of DISABLED and UNCHECKED would pass the test.if {[LB::status pool $LBpool member $LBmember $LBport] eq "up"} {
and we had to instead use the syntax as in the example above:if {[LB::status node $::BSIFNODE1 up] == 0} {
Let me know if you've verified that the correct boolean is returned in all cases in 9.3.0, and I'll do some further testing & update the wiki if appropriate.if {[LB::status...] ne "up"} {
- William_Benett1
Nimbostratus
So I changed my code to [LB::status node $::BSIFNODE1]eq "down" per the LB::status page, but it still seems to get the incorrect node status. - Deb_Allen_18Historic F5 AccountOK, thanks for the feedback, and for bringing the problem to our attention in the first place.
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