Example: Migrating - Listing the running server groups
The following examples demonstrate how to list running server groups in the WAS V4.0 and V6.x:
- wscp V4.0
set groups [ServerGroups list] foreach sgroup $groups { set thestate [ServerGroup show $sgroup -attribute {Name CurrentState} puts $thestate }- wsadmin V6.x
set clusters [$AdminControl queryNames type=Cluster,*] foreach scluster $clusters { set thestate [$AdminControl getAttributes $scluster {clusterName state}] puts $scluster $thestate }# get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') clusters = AdminControl.queryNames('type=Cluster,*').split(lineSeparator) for scluster in clusters: thestate = AdminControl.getAttributes(scluster, ['clusterName', 'state']) print scluster + " " + thestate + "\n"
See Also
Commands for the AdminControl object