Forum Discussion
Irule Environment Variables: Any?
What environment variables are provided for irule? I have tried a couple of ways but could not see any. I'd like to know the hostname through a low-cost method.
2 Replies
- THi
Nimbostratus
See -tcl_platform - A variable that contains platform specific information
The hostname can be retrieved with
static::tcl_platform(machine)Returns the hostname of the BIG-IP
- THi
Nimbostratus
Did you get this working? I needed to implement pool selection based on active unit hostname and tested it now, but got stuck, as the static::tcl_platform variable wasn't working. There seems to be a bug on 11.4.0 and newer. There is a one line iRule workaround for it which needs to be used in RULE_INIT event.See sol14544: The tcl_platform iRules variable is not in the static:: namespace.
However I found another way of getting the hostname, using [info hostname] TCL-function. Tested and it works like a charm. Use it in RULE_INIT event to assign the retrieved hostname value to a static variable, which can be used in other events/iRules later. For example:
set static::host [info hostname]
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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