Forum Discussion

bigipjr28_13978's avatar
bigipjr28_13978
Icon for Nimbostratus rankNimbostratus
Jan 13, 2014

using tmsh commands in tcl script

Hey all,

 

I am new to the community as well as f5 technologies in general. Ill give a synopsis as to I am looking to accomplish by using a tmsh script.

 

At my company we do site switches where we fail over applications depending on work thats be done at DC or another. And at times we have failover close to 70 applications. My question is if I was going to use for instance the tmsh cmd:

 

modify gtm pool members modify { :https { disabled } } modify gtm pool members modify { :https { enabled } }

 

In a script how would I got about adding it to the script?

 

Also, I created a test.tcl file in my home directory and executed (Active)(tmos) run cli script but couldnt find the file. How would I execute it?

 

Thanks

 

  • I have been messing around with some tcl stuff. I want to change the order of vips in a pool on the GTM. How would I inject this command into the tcl script ?

     

    Here is the cmd I want to use ultimately - tmsh::modify /gtm pool poolname members modify { :https { order 1 }}

     

    Here the test bed script that I put together:

     

    modify script flip.tcl {

     

    proc script::run {} {

     

    tmsh::modify /gtm pool poolmen members modify { :https { order 1 }}

     

    }

     

    Its saves without error but I executed I get this error:

     

    flip.tcl: script failed to complete: can't eval proc: "script::run" members: required brace is missing "{" while executing "tmsh::modify /gtm pool sdx-pq1-pool members modify { 10.15.10.200:https { order 1 }}" (procedure "script::run" line 3) invoked from within "script::run" line:1 script did not successfully complete, status:1

     

    any help will be great! thanks

     

  • ok thanks that makes sense as to how to do. Usually a list, depending on whats going could be 5 to almost 70. So, if I were to add those cmds in the tcl file could that ultimately work..without any logic?

     

    Looks like there is a template that gets created when you create a new file.

     

    modify script test.tcl { proc script::init {} { }

     

    proc script::run {} { }

     

    proc script::help {} { }

     

    proc script::tabc {} { } }

     

    Not all that familiar with tcl...does f5 have any good resources for tcl scripting? where in this template would I add: modify gtm pool members modify { :https { disabled } } modify gtm pool members modify { :https { enabled } }

     

    Thanks for the help

     

  • you need to write the scripts in the tmsh shell (or import them). At at tmsh prompt:

    edit cli script test.tcl
    run cli script test.tcl (or make an alias)
    

    do you start from a list of wideIPs, or is it all of them?