Date Created: Thu 10-Jan-2008

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Sample usage in unix:

wsadmin.sh -lang jython -f ./show_cluster_status.py <clusterName>

-----------------------------------------------------------------
possible improvement would be to check that cluster exists and that
a cluster name has been passed is as a command line paramter.

-----------------------------------------------------------------

i = 0
clusterName = sys.argv[i]
clusterId = AdminConfig.getid("/ServerCluster:"+clusterName+"/" )
print "ClusterName is: "+clusterName

if (len(clusterId) != 0):
clusterObject = AdminControl.completeObjectName("type=Cluster,name="+clusterName+",*" )
clusterStatus = AdminControl.getAttribute(clusterObject, "state" )
print "clusterStatus="+clusterStatus
running = "websphere.cluster.running"
partialstart = "websphere.cluster.partial.start"
starting = "websphere.cluster.starting"
stopped = "websphere.cluster.stopped"

if (cmp(clusterStatus, starting) == 0):
print "starting"
sys.exit()
#endIf

if (cmp(clusterStatus, stopped) == 0):
print "stopped"
sys.exit()

#endIf

if (cmp(clusterStatus, running) == 0):
print "running"
sys.exit()

#endIf

if (cmp(clusterStatus, partialstart) == 0):
print "partialstart "
sys.exit()

#endIf


else:
print "Error"
#endElse


I have many WebSphere Jython example scripts being available here:
http://www.themiddlewareshop.com/category/websphere-jython-examples/
http://www.themiddlewareshop.com/category/websphere/websphere-application-server/jython/

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/


Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories