Created
June 6, 2013 14:44
-
-
Save codyrat/5722042 to your computer and use it in GitHub Desktop.
F5 show tmsh pool status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@llb2(Active)(tmos)# edit cli script pool-status.tcl | |
modify script pool-status.tcl { | |
proc script::run {} { | |
set pool_names "" | |
if { $tmsh::argc == 1} { | |
puts "enter one or more pool names" | |
exit 1 | |
} | |
set pool_names [lrange $tmsh::argv 1 end] | |
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 { $usable > 0 && [expr 2 * $usable] >= $total } { | |
puts "up: $pn" | |
} else { | |
puts "dn: $pn" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment