script to disable all pool members if minimum not met

I wrote this originally in perl using iControl and decided to re-write it via tmsh.

I used some stuff from the code share but modified it.

Small, simple, effective.

The basics to get this script installed are:

Type these:

tmsh

cli script

edit min-member-pool.tcl

set noautoindent

set nosmartindent

Copy & paste in the contents of the script

Save and quit the editor

After it successfully accepts the script you can call it from the regular “advanced cli” (in other words “bash”) as:

tmsh run cli script min-member-pool.tcl |reset

I’ll need to write a wrapper that does some proper EAV functions and calls this script to do the actual evaluation and actions.

Mind if we add this to the codeshare?

Hi Russell,

I tested your script on my BigIP with version 10.2.1 and found it cannot work.

The up number or total number is always 0:

dn: supl_inbound_pool_v4 total up/available: 0, total 0

Seems below part is not working as expected:

foreach obj [tmsh::get_status /ltm pool $pool_name detail] {

if { [tmsh::get_type $obj] != “ltm pool-member” } {

continue

}

incr total

if { [tmsh::get_field_value $obj pool-member.status.availability-state] == “available” &&

[tmsh::get_field_value $obj pool-member.status.enabled-state] == “enabled” } {

incr usable

}

}

The reset function works fine.

Could you please take a look?

Br,

Alex

Hi,

can we have a final script which work,

I have tested the script min-members-pool.tcl.txt , but not able to get the result