Forum Discussion
syntax question
So let me start by saying I am new to TMSH and don't come from a scripting background.
I am writing a script that will create a custom monitor, a pool adding prepopulated nodes (every app has a pool with the same nodes in it) and the virtual host. I have something working that will do the first two steps but I want to make it prettier before I get to the third. I am a bit OCD and want the names to work.
So this is what I have (amazing what you can steal from the F5 articles and forums)
modify script /Common/josetest.tcl { <-----taken from the tmsh scripting page
proc script::init {} {
proc getFeedback { question } {
puts -nonewline $question
flush stdout
return [gets stdin]
}
}
proc script::run {} { <--------------put this next part all together from bits and pieces but it works
set app_name [getFeedback "what is the application name? "]
set tomcat [getFeedback "what is the tomcat port? "]
tmsh::create ltm monitor tcp $app_name defaults-from tcp interval 30 timeout 90 destination *:$tomcat
tmsh::create ltm pool $app_name {members add {172.20.36.110:80 172.20.36.111:80 172.20.36.112:80 172.20.36.113:80}} monitor $app_name
}
proc script::help {} {
}
proc script::tabc {} {
}
}
********SO my question is this...
I want the monitor name to be $app_name followed by "_" $tomcat
so it would look like this
what is the application name? TFA-joetest (Test Fast App-application name)
what is the tomcat port? 6789
then my monitor would endup in the monitor list as TFA-joetest_6789
Not sure of the syntax of adding the two values together I tried $app_name;-;$tomcat am I even in the right ballpark? (Sorry if this is a stupid question)
One more question, is there anyway to have my pool members in another location like a file or a class or data group list? This would be for a test application with 4 nodes, the prod apps have 25 nodes! 8^)
Thank you as always!!!
Joe
1 Reply
- sundogbrew
Altocumulus
Never mind about the first part, I figured out how to do what I want with quotes.
I would still like to know if I can do the data group lists though.
Thanks
Joe
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