Date Created: Thu 10-Jan-2008

Related Document Categories:


    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

Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

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

Oracle WebLogic Categories

JBoss Categories

Other Categories