Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral


Questions and Answers

Loading... Loading...

Hi,

I'm looking to use more than 1 monitor for my pool members. For example I would like to use both http and tcp monitors. In my custom iApp template I have added the following code to Presentation under the section server_pools

 

optional ( create_new_monitor == "Use Monitor..." ) {
                multichoice reuse_monitor_name display "xlarge" tcl {
                    tmsh::run_proc f5.app_utils:get_ltm_monitors_filter http tcp
                }
            }
 
This allows me to chose which monitors I would like to use. However the implementation code does not allow more than 1 monitor to be chosen. Any ideas what code I need to use to allow two monitors to be enabled for the pool members with a min 1?
 
I've even thought about moving the tcp monitor into it's own section. For example:
 
yesno tcp_monitor
 
and then in the implementation section added the set add_tcp_monitor
 
# create pool
        set servers $::server_pools__servers
        set lb_method $::server_pools__lb_method_choice
        set pool_name [tmsh::run_proc f5.app_utils:create_pool \
            $tmsh::app_name $monitor_name "\{$servers\}" $lb_method ]
 
        set do_queuing $::server_pools__tcp_request_queuing_enable_question
        if { $do_queuing == $::YES_ANSWER } {
            set queue_length $::server_pools__tcp_request_queue_length
            set time_limit $::server_pools__tcp_request_queue_timeout
        } else {
            set queue_length 0
            set time_limit 0
        }
        tmsh::run_proc f5.app_utils:do_tcp_request_queue_settings \
            $pool_name $do_queuing $queue_length $time_limit
 
        set add_tcp_monitor $::server_pools__tcp_monitor
         if { $add_tcp_monitor == $::YES_ANSWER } {
tmsh::run_proc f5.app_utils:do_tmsh_modify ltm pool $tmsh::app_name.app/$pool_name monitor min 1 of \{ http tcp \}
        }
 
    } else {
        set pool_name $::server_pools__reuse_pool_name
    }
 
I've tested the tmsh command on the cli and it does work. However each time I attempt to create/modify an iApp Application using my template I receive the following error:
 
script did not successfully complete: (wrong # args: should be "do_tmsh_modify component arguments"
while executing
"do_tmsh_modify ltm pool F5_testing.app/F5_testing_pool monitor min 1 of { http tcp }"
invoked from within
"tmsh::run_proc f5.app_utils:do_tmsh_modify ltm pool $tmsh::app_name.app/$pool_name monitor min 1 of \{ http tcp \}"
(procedure "configure_maximo_deployment" line 89)
invoked from within
"configure_maximo_deployment"
invoked from within
"if { $provisioned == "provisioned" } {
if { [tmsh::run_proc f5.app_utils:is_safe_app_name "\"$tmsh::app_name\""] != true } {
puts "The app..." line:280)
 
Could be that I am using the wrong command (do_tmsh_modify) to achieve my objective, or do I need to use " " somewhere, or there is another way to do this?
 
Thanks
 
 
 
 
 
 
 

2 Answer(s):

TMSH syntax requires monitor names to be connected with the word "and". If you go with your original multichoice idea in the presentation, the list of monitors will be returned to you as a space-separated list. A quick conversion should solve your problem:

set monitor_name [list [join $::server_pools__reuse_monitor_name " and "]]
Hi Fred,

Thanks for your response. Your code did resolve the issue I had when using the multichoice for existing monitors so many thanks for that. For those of you who are interested my implementation looks like this now

# create monitor
if { $::server_pools__create_new_monitor == $::CREATE_NEW_MONITOR_OPTION} {
set monitor_interval $::server_pools__monitor_interval
set monitor_recv \"$::server_pools__monitor_recv\"
set monitor_send \"$::server_pools__monitor_send\"
set http_version $::HTTP_11_VERSION_STRING
set monitor_type http
set monitor_dns_name $::server_pools__monitor_dns_name

set monitor_name [tmsh::run_proc f5.app_utils:create_monitor \
$tmsh::app_name $monitor_type $monitor_interval "$monitor_send" \
"$monitor_recv" "$http_version" $monitor_dns_name]

} else {
set monitor_name [list [join $::server_pools__reuse_monitor_name " and "]]
}

I also added an adjustment which would allow to create a new http monitor and then attach a tcp monitor by default.

implementation...

# create pool
set servers $::server_pools__servers
set lb_method $::server_pools__lb_method_choice
set pool_name [tmsh::run_proc f5.app_utils:create_pool \
$tmsh::app_name $monitor_name "\{$servers\}" $lb_method]

set do_queuing $::server_pools__tcp_request_queuing_enable_question
if { $do_queuing == $::YES_ANSWER } {
set queue_length $::server_pools__tcp_request_queue_length
set time_limit $::server_pools__tcp_request_queue_timeout
} else {
set queue_length 0
set time_limit 0
}
tmsh::run_proc f5.app_utils:do_tcp_request_queue_settings \
$pool_name $do_queuing $queue_length $time_limit

if { $::server_pools__tcp_monitor == $::YES_ANSWER } {
tmsh_modify "/ ltm pool" "$pool_name monitor $monitor_name and tcp"
}

presentation...

optional ( create_new_monitor == "Create New Monitor" ) {
string monitor_interval default "30" required validator "NonNegativeNumber" display "small"

string monitor_send default "GET /" required display "xlarge"

string monitor_dns_name required validator "FQDN" display "large"

string monitor_recv

yesno tcp_monitor
}

Thanks for your input again Fred.


Your answer:

You must be logged in to reply. You can login here.