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

Filter by:
  • Solution
  • Technology
Answers

Multiple health monitors to pool

Has anyone modified an iApp to include an option to add multiple health monitors to one pool? If so, can you please provide examples of how you did this?

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

I posted my version of this multi-monitor template at https://devcentral.f5.com/wiki/iApp.HTTP-Template-with-Multiple-Monitors.ashx

1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Don't disable strictness. Re-code your iApp! In presentation, change your "choice" to a "multichioce", for example: multichoice reuse_monitor_name display "xlarge" tcl { tmsh::run_proc f5.app_utils:get_ltm_monitors_filter http https tcp } and in implementation, change the tmsh statement to add your list of monitors, separated by the word "and". For example: set monitor_name [list \ [join $::server_pools__reuse_monitor_name " and "]]

2
Comments on this Answer
Comment made 23-Jan-2014 by Ed Carpon 13
I appreciate the help but i cannot seem to get this working how you stated. I am attempting to duplicate the f5 HTTP template. Below is what I am editing from the presentation section. optional ( create_new_monitor == "Use Monitor..." ) { choice reuse_monitor_name display "xlarge" tcl { package require iapp 1.0.0 return "[iapp::get_items ltm monitor http]\n[iapp::get_items ltm monitor https]" Just doing this does not change how it looks when you select the edited iApp template.
0
Comment made 23-Jan-2014 by Fred Slater
If you replace the keyword "choice" with "multichoice", do you see the change in presentation?
0
Comment made 23-Jan-2014 by Ed Carpon 13
No I do not.
0
Comment made 23-Jan-2014 by nathan 7337
Thanks for that Fred, a lot better way of doing things.
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ed- I see we are discussing the wrong section of the template. Look for this section:

section monitor {
            choice monitor display "xxlarge" default "/#create_new#" tcl {
                package require iapp 1.1.1
                set choices "Create a new health monitor\t/#create_new#\n[iapp::get_items ltm monitor http]\n[iapp::get_items ltm monitor https]\n[iapp::get_items -filter NAME != "external" ltm monitor external]"
                return $choices
            }

Replace "choice" with "multichoice" and delete the "default" clause, and you will get this:
Image Text

1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ed- I suggest splitting the questions a different way, so that the "create new" scenario is separate from the list of existing ones. For example:

section monitor {
        choice monitor display "xxlarge" default "/#create_new#"
        optional ( monitor == "/#use_existing#" ) {
            multichoice monitors display "xxlarge" tcl {
                package require iapp 1.0.0
                set choices "[iapp::get_items ltm monitor http]\n[iapp::get_items ltm monitor https]\n[iapp::get_items ltm monitor external]"
                return $choices
            }
        }
    }

text {
    monitor.monitor "Create a new health monitor or use an existing one?" {
        "Create a new HTTP monitor" => "/#create_new#",
        "Choose from a list of existing monitors" => "/#use_existing#"
    }
    monitor.monitors "Select the monitors you wish to use."
}

That should give you something like this: Image Text

Then modify the same 2 lines that you modified before to use the new variable "monitors":

    1,0,1 { monitor [join $::monitor__monitors " and "] }
    1,0,0 { monitor [join $::monitor__monitors " and "] }

And when you select multiple monitors, you should see them in the component view: Image Text

1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Ed - yeah that's possible. You just need to disable Strict Updates, else it will complain and won't let you make the change.

If you do go back into the iApp and amend anything in here, under Reconfigure, then any custom changes like this are reset.

N

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

A simple change to the implementation will allow existing monitors to work. Replace:

        1,0,1 { monitor $::monitor__monitor }
        1,0,0 { monitor $::monitor__monitor }
with:
        1,0,1 { monitor [join $::monitor__monitor " and "] }
        1,0,0 { monitor [join $::monitor__monitor " and "] }

The "Create a new HTTP monitor" option is trickier to mix with the others, and would take more code changes.

0
Comments on this Answer
Comment made 23-Jan-2014 by Ed Carpon 13
Awesome this works. If you select 'Create a new HTTP monitor' from the options it looks like it doesnt actually prompt like before. Is there a way to get that back in addition to having the multichoice? Appreciate all of the help.
0
Comment made 23-Jan-2014 by Fred Slater
Easiest way is probably to split the questions. First ask if the user wants to "Create New" or "Select from existing", then show the multichoice only if the user selects " from existing".
0
Comment made 24-Jan-2014 by Ed Carpon 13
I was able to create the separate question successfully in the presentation section, but it looks like I am still having issues in the Implementation section for monitor1. Presentation section monitor { multichoice monitor display "xxlarge" tcl { package require iapp 1.0.0 set choices "[iapp::get_items ltm monitor http]\n[iapp::get_items ltm monitor https]\n[iapp::get_items -filter NAME != "external" ltm monitor external]" return $choices } choice monitor1 display "xxlarge" default "/#create_new#" tcl { package require iapp 1.0.0 set choices "/#create_new#" return $choices } optional ( ssl_encryption_questions.help == "max" ) { message monitor_max } optional ( monitor1 == "/#create_new#" ) { optional ( ssl_encryption_questions.legacy_advanced == "yes" || ssl_encryption_questions.advanced == "yes" ) { string frequency display "medium" required default "30" optional ( ssl_encryption_questions.help == "max" ) { message freq_max } choice http_method display "xxlarge" default "GET" optional ( ssl_encryption_questions.help == "max" ) { message method_max } } Implementation 1,1,1 { monitor1 [iapp::conf create ltm monitor $http_or_https \ ${app}_${http_or_https}_monitor \ defaults-from $http_or_https \ interval $::monitor__frequency \ timeout [expr { $::monitor__frequency * 3 + 1 } ] \ [expr { [iapp::is ::monitor__anonymous "no"] ? \ "username $::monitor__user password $::monitor__passwd" : "" }] \ send [iapp::substa send_string_arr($advanced,$http11,$http_post)]\ recv '$::monitor__response'] } 1,1,0 { monitor1 [iapp::conf create ltm monitor $http_or_https \ ${app}_${http_or_https}_monitor \ defaults-from $http_or_https \ interval 30 \ timeout 91 \ send [iapp::substa send_string_arr($advanced,$http11,$http_post)]\ recv '$::monitor__response'] } 1,0,1 { monitor1 [join $::monitor__monitor " and "]} 1,0,0 { monitor1 [join $::monitor__monitor " and "]} * { monitor1 none }
0