Forum Discussion
jlarger
Cirrus
Aug 21, 2018tcl script error
I'm trying to implement the tcl script for server stats at https://devcentral.f5.com/codeshare?sid=314.
We're on 11.6.3.
The field value appears to be correct, since the output of show ltm ...
Andy_McGrath
Cumulonimbus
Aug 22, 2018Line 23 has a '.' in front of the
status.availability-state
which is incorrect, remove it and it should work find
Or copy from here:
modify script virtual_stat.tcl {
proc script::init { } {
}
proc getPartition { partition } {
puts $partition
flush stdout
return [gets stdin]
Choose the partition you want to be tested
}
proc script::run { } {
set up ""
set down ""
set total 0
set out 0
set part [getPartition "Enter the partition you want to be tested"]
tmsh::cd \/$part
foreach { virtual } [tmsh::get_status /ltm virtual] {
set total [expr { $total + 1 }]
if { "available" ne [tmsh::get_field_value \
$virtual "status.availability-state"] } {
set out [expr { $out + 1 }]
append down " " [tmsh::get_name $virtual] "\n"
}
}
set result "\n\n"
append result $out " pools are down among " $total "\n Inactive Virtuals:\n\n"
if { [string length $down] == 0 } {
append result " none\n"
} else {
append result $down
}
tmsh::display $result
}
proc script::help { } {
tmsh::add_help "display the list of virtual servers that are down"
}
proc script::tabc { } {
if this function does nothing then tmsh will (visual) beep
}
}
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