Bootstrap FreeKB - IBM WebSphere - wsadmin get cell, node, cluster or server ID
IBM WebSphere - wsadmin get cell, node, cluster or server ID

Updated:   |  IBM WebSphere articles

If you are not familiar with wsadmin.sh (Linux) / wsadmin.bat (Windows), check out our Getting Started article.

The following wsadmin AdminConfig command can be used to get the name of each cell within a profile. This example uses jython.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminConfig.list('Cell')"

 

Which should return something like this.

myCell(cells/myCell|cell.xml#Cell_1)

 

Let's say you have a cell named myCell. Here is how you would get the ID of the cell using jython.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminConfig.getid('/Cell:myCell')"

 

And here is how you would get the ID of the cell using jacl.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jacl -c "print $AdminConfig getid ('/Cell:myCell')"

 

Which should return something like this.

myCell(cells/myCell|cell.xml#Cell_1)

 

Here is how you would get the ID of a node using jython.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminConfig.getid('/Node:myNode')"

 

And here is how you would get the ID of the node using jacl.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jacl -c "print $AdminConfig getid ('/Node:myNode')"

 

Which should return something like this.

'myNode(cells/your_cell/nodes/myNode|node.xml#Node_1)'

 

Here is how you can get the name and ID of the clusters in your cell using jython.

~]$ /opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminClusterManagement.listClusters()"
WASX7209I: Connected to process "dmgr" on node your_node using SOAP connector;  The type of process is: DeploymentManager
---------------------------------------------------------------
 AdminClusterManagement: List server clusters
 Usage: AdminClusterManagement.listClusters()
 Return: List of the clusters in the cell.
---------------------------------------------------------------
 
 
cluster is found: Cluster01(cells/Cell01/clusters/Cluster01|cluster.xml#ServerCluster_1699955548167)
['Cluster01(cells/Cell01/clusters/Cluster01|cluster.xml#ServerCluster_1699955548167)']

 

Or, if you already know the cluster name, here is how you would get the ID of a cluster using jython.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminConfig.getid('/ServerCluster:myCluster')"

 

Or using jacl.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jacl -c "print $AdminConfig getid ('/ServerCluster:myCluster')"

 

Which should return something like this.

'myCluster(cells/your_cell/clusters/myCluster|cluster.xml#ServerCluster_123456789)'

 

Here is how you would get the ID of a server (web server or application server) using jython.

/opt/WebSphere/AppServer/profiles/your_profile/bin/wsadmin.sh -lang jython -c "print AdminConfig.getid('/Server:myWebServer')"

 

Which should return something like this.

'myWebServer(cells/your_cell/nodes/myNode/servers/myWebServer|server.xml#Server_123456789)'

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 19e1f3 in the box below so that we can be sure you are a human.