Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I run TMSH commands inside an iRule?

mahanth
Altostratus
Altostratus

I have added:     

 

set NODENAME [HTTP::header value test]

 POOLMEMBER_IP=($(tmsh list ltm node $NODENAME | grep "address" | awk '{print $2}'))

 

1) I am trying to run tmsh commands using/in iRule

2) Trying to get just the Node IP from Node Name

9 REPLIES 9

Hello Mahanth.

 

I think you are mixing concepts. Take into account this:

  • TMSH are management plane scripts
  • iRule are dataplane scripts.

 

So, you cannot access a F5 config using iRule commands.

One idea that you could use is to resolv your server hostname using your DNS.

[lindex [RESOLV::lookup $hostname] 0]

REF - https://clouddocs.f5.com/api/irules/resolv__lookup.html

 

Regards,

Dario.

Regards,
Dario.

Please note that with v15 RESOLV::lookup is deprecated and no longer supported!

https://clouddocs.f5.com/api/irules/RESOLVER__name_lookup.html

https://clouddocs.f5.com/api/irules/DNSMSG__record.html

Regards,
Dario.

which just includes that it can no longer be written nicely on one line...or 2...or 3... 🙂

JRahm
Community Manager
Community Manager

deprecated just means it is marked for removal in a future version. As long as it's still available it will be supported.

Trust me, with v15 you dont want to use that anymore, unless you are ready for core dumps....

I guess you mean this:

https://cdn.f5.com/product/bugtracker/ID916753.html

It's a problem with the object name resolution, but it has workaround.

Regards,
Dario.

Yeah, thats the one we raised. And it has a workaround but its not so easy to implement depending on the environment you have, since we have a complete custom dev cycle for irules. But, well.

JRahm
Community Manager
Community Manager

Ok fair enough, Rene! 😃

 

But generally, deprecated doesn't mean immediate death sentence. Test, test, then test some more, and as I recommend with any new release, comb the release notes and if there is a better way forward with any implementation, iterate through those updates as resources allows.