Virtual Servers Stats
Problem this snippet solves:
This example shows how to display a list of virtual servers that are currently marked as down.
Code :
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 } }
Published Mar 10, 2015
Version 1.0CodeCentral_194
Cirrus
Joined May 05, 2019
CodeCentral_194
Cirrus
Joined May 05, 2019
- jlargerCirrus
I'm trying to implement this tcl script in 11.6.3. Apparent the field names have changed. Can anyone tell me how to enumerate the current valid field values (or what this value has changed to)?
vs_stat.tcl: script failed to complete: can't eval proc: "script::run" field not present: ".status.availability-state" while executing "tmsh::get_field_value $virtual ".status.availability-state""
- Lee_SutcliffeNacreous
There is a typo in your codeshare
line 23: $virtual ".status.availability-state"] } {
the "." is throwing an error. should be
$virtual "status.availability-state"] } {