wsadmin get list of servers in a cluster

WSAdmin used in headless mode by Release Engineer

Use WSAdmin with Release Engineer to manage server clusters

This blog covers how to get a list of servers in a cluster using wsadmin.  Managing a cluster of servers can be difficult to do with simple scripting.  Release Engineer provides a platform for developing more intelligence in your scripts that can be reused by other team members. So once you figure out that clever process, you can share it with others.

Whatever you may be using to orchestrate the calling of your deployment does not matter much. What matters is the ability to create a reproducible process for calling wsadmin that all team members, from development to operations, can understand and track.  Release Engineer allows you to define a process, calling wsadmin to build a list of servers in the cluster. Below is the code you will need to add to your Release Engineer workflow step that calls for the websphere cluster list.

 clusterId=AdminConfig.getid("/ServerCluster:"+clusterName) clusterMembers=AdminConfig.list('ClusterMember', clusterId) clusterMembers = wsadminToList(clusterMembers) 

This code performs 3 basic steps:

1. Get the cluster id based on the cluster name.
2. Get the list of members for the cluster id.
3. Convert the list of members into a Jython array.

You will need to convert a string to a list – wsadminToList is found here.

 

Leave a Reply

Your email address will not be published. Required fields are marked *