Forum Discussion

Terrence's avatar
Terrence
Icon for Nimbostratus rankNimbostratus
Dec 05, 2011

dns lookups in an iapp template

I am having a hard time being able to get this working.

 

 

The application administrators use dns names to remember which servers host which applications, so I would like my nodes to be named accordingly so that alerts have useful information.

 

 

I am attempting to modify the default http template, so that it creates the nodes with names provided by dns.

 

 

I thought that doing using tmsh::run +short -x ip_address would allow me to do a reverse. It does infact do a reverse, however i do not believe that the value is returned to the set server_name, but instead printed to stdout.

 

 

Is there any other way that I could accomplish this?

 

 

set server_name [tmsh::run util dig +short -x $server_addr]

 

 

  • Brent_Blood_768's avatar
    Brent_Blood_768
    Historic F5 Account
    I don't believe tmsh::run allows you to capture stdout, but exec will. Try something like this and I think you'll be able to move past where you are now:

    set ips [exec dig +short $host] 

    Cheers,

    -Brent

  • Yup that was the solution. And where would I find the exec command. I am having a hard time tracking down the right reference material. Is that a tcl builtin function?
  • Brent_Blood_768's avatar
    Brent_Blood_768
    Historic F5 Account
    Yeah - exec is a TCL builtin. For iRules stuff like that isn't available, but in iApps we don't have those sorts of restrictions, so scripts have more of the capabilities of TCL available to them. I think as an admin user you can use any commands other than "interp", though as non-admins the available commands are restricted somewhat.

    The web of course is a great place to find documentation about TCL and its builtin functions. In case you're running Debian in your dev environment, the "tcl-doc" package installs manpages for the built-in commands which can be really handy. For example, to see the doc for exec, at a shell I type:

    man 3tcl exec

    and this gives me everything I need to use that command.

    Cheers,

    -Brent