Forum Discussion

mahanth's avatar
mahanth
Icon for Altostratus rankAltostratus
Aug 17, 2020

Can I run TMSH commands inside an iRule?

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

  • 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.

    • Rene_C_'s avatar
      Rene_C_
      Icon for Nimbostratus rankNimbostratus

      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