Forum Discussion
Formater
Employee
Jan 27, 2011How send a string to a specific IP's specific port when all pool members of a VIP are down?
I have a customer who has a pool, which includes there pool members. They want to send some special string in TCP to a specific IP's specific port when all the members of this pool are down. For example, when all members of the pool are down, just send message "down" to 10.10.10.1:12000. The VIP they uses is a Standard type, and the version is v9.3.1
I am wondering to use TCP::response to reponse, but the specific port is NOT port carrried in TCP::response.
Anyone has some idea?
Johnson
3 Replies
- hoolio
Cirrostratus
Hi Johnson,
I wonder if you could check for [active_members [LB::server pool]] == 0 in CLIENT_ACCEPTED. If it is true, then collect the TCP payload with TCP::collect, replace all of it with TCP::payload replace and then select a new destination IP:port with the node command. Here are the wiki pages for the related commands:
http://devcentral.f5.com/wiki/default.aspx/iRules/lb__server
http://devcentral.f5.com/wiki/default.aspx/iRules/active_members
http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__collect
http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__payload
http://devcentral.f5.com/wiki/default.aspx/iRules/node
Aaron - Colin_Walker_12Historic F5 AccountAaron: That sounds plausible, actually. You couldn't use LB::server pool in CLIENT_ACCEPTED really, since no pool would have been selected yet, but you could certainly use active_members if you know the specific pool anyway.
Something like (very untested):when CLIENT_ACCEPTED { if {[active_members yourpoolname] == 0 } { TCP::collect } } when CLIENT_DATA { TCP::payload replace 0 [TCP::payload length] "down" node 10.10.10.1 12000 TCP::release }
Worth a shot at least. Try it out on a test VIP first as it's not tested, but that's the general idea.
Colin - hoolio
Cirrostratus
[LB::server] and [LB::server pool] will return the virtual server's default pool name until a load balancing decision has been made. Once a load balancing decision has been made, [LB::server] will return a Tcl list with pool, node addr and port.
I think it was Unruley who pointed this out originally a while back. It makes for a simple way to avoid having to hard code the default pool name in iRules.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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