Forum Discussion
dan_19334
Nimbostratus
Jan 19, 2010ECV-Determine Pool Member Status
Hi, is there a good way to determine nodes that are available and not disabled from the command line? I am writing a custom monitor script and it seems I have to check two places to ensure that a Nod...
Mark_Crosland_2
Jan 24, 2010Historic F5 Account
In 10.1 you can do something like the script below. You still need to look at a couple values, but you can be more specific about what you are looking for and are not dependent on command output formatting.
You could also up/down the dummy pool in this script based on status results.
bash tmsh
(tmos) create cli script pool-status.tcl
Then call the script from somewhere.
tmsh run cli script pool-status.tcl
create 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
get the status of each pool
foreach obj [tmsh::get_status /ltm pool $pn 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
}
}
example, require a quorum to consist of at least half of the members
if { $usable > 0 && [expr 2 * $usable] >= $total } {
puts "up: $pn"
} else {
puts "dn: $pn"
}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects