Forum Discussion
JRahm
Sep 11, 2014Admin
You'll need to customize to only actually modify when there is a change in state rather than because the status is above/below the threshold (as I've shown below with the simple if/else condition), but this should get you started down the path:
foreach pn $pool_names {
set total 0
set usable 0
foreach obj [tmsh::get_status /ltm pool $pn detail] {
foreach member [tmsh::get''field''value $obj members] {
incr total
if { [tmsh::get''field''value $member pool-member.status.availability-state] == "available" &&
[tmsh::get''field''value $member pool-member.status.enabled-state] == "enabled" } {
incr usable
}
}
}
if { [expr $usable.0 / $total] < 0.7 } {
tmsh::modify /net interface 1.1 disabled
} else { tmsh::modify /net interface 1.1 enabled }
}