The following examples demonstrate how to list running server groups in the WebSphere Application Server V4.0 and V6.x:
set groups [ServerGroups list] foreach sgroup $groups { set thestate [ServerGroup show $sgroup -attribute {Name CurrentState} puts $thestate }
set clusters [$AdminControl queryNames type=Cluster,*] foreach scluster $clusters { set thestate [$AdminControl getAttributes $scluster {clusterName state}] puts $scluster $thestate }Using Jython:
# 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"
Related reference
Commands for the AdminControl object