Forum Discussion
iRule able to ask what Virtual it's running on?
My question is: In iRules, is there a way for a running iRule to return the name or names of the VIP or Pool (name or ID)?
What sort of call would it be? Maybe a simple example?
We're trying an experiment with cookies to decide the pool selection. Rather than having a unique iRule per VIP (with the VIP name filled in), we'd like to have a generic one that we could simply use a query to figure out what VIP it's running on and match it to the cookie.
Any chance?
Thanks
D
- Lee_Sutcliffe
Nacreous
You can use the virtual command to return the name of the VS
when HTTP_REQUEST { log local0. "Current virtual server name: [virtual name]" }
https://devcentral.f5.com/wiki/iRules.virtual.ashx
You can use [LB::server pool] to return the selected pool, assuming one has been selected.
when CLIENT_ACCEPTED { Save the name of the VIP's default pool set default_pool [LB::server pool] }
- youssef1
Cumulonimbus
Hello,
you can do this simply (If in understand your need):
when HTTP_RESPONSE { log local0. "VS Name: [virtual]" serverside { log local0. "pool member IP: [serverside {IP::remote_addr}]:[serverside {IP::remote_port}]" } }
So using this irule you can retrieve Pool memeber that you reach an VS that you use for each request.
If you give me more details about your need keep me in touch.
Regards
Recent Discussions
Related Content
* 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