WPS Cluster
WPS Cluster Status
After searching on the internet for the existing scripts for the WPS cluster status, I found Steve Robinson's site with Jython script. He suggested the user to enter the cluster name as a command line argument.I also found a jython script from IBM DeveloperWorks forums, where the script contains cell name hard-coded. To execute the script we need to know the cell name of their WPS environment. My idea here is to make a generic script, that is, without giving these two inputs after connecting to the DeploymentManager cannot we fetch the status of the cluster? Strugled for two hours to articulate the facts about the JMX runtime beans, that will gives us the status. This is initial step to monitor a WebSphere Process Server.
This automation Jython script will help WPS Developer/Administrators who wish to check the cluster status without connecting to WebSphere console.
Advantages
Human errors can be eliminated no need to remember Cellname, ClusterName
For multi-clustered Websphere environment, clusters can be monitored faster
Jython Script
Script File : clustrStat.py
cell=AdminConfig.list('Cell')
cellName=AdminConfig.showAttribute(cell, 'name')
x=AdminConfig.list('ServerCluster', AdminConfig.getid( '/Cell:'+cellName+'/')).split('\n')
for c in x:
cl=c.split('(')[0]
clusterId = AdminConfig.getid("/ServerCluster:"+cl+"/" )
print "ClusterName is: "+cl
if (len(clusterId) != 0):
clusterObject = AdminControl.completeObjectName("type=Cluster,name="+cl+",*" )
clusterStatus = AdminControl.getAttribute(clusterObject, "state" )
print "clusterStatus="+ clusterStatus
Invoking Jython Script
Please replace user, password as per your environment,
Script File: clustrStat.sh
#!/bin/bash
clear
date
wsadmin.sh -lang jython -f clustrStat.py -user <user> -password <password>
date
Output resulted as follows:
$ clustrStat.sh
Mon Jun 25 04:57:15 EDT 2012
WASX7209I: Connected to process "dmgr" on node zqMywps01CellManager01 using SOAP connector; The type of process is: DeploymentManager
ClusterName is: Mywps.AppTarget
clusterStatus=websphere.cluster.running
ClusterName is: Mywps.Messaging
clusterStatus=websphere.cluster.running
Mon Jun 25 05:01:11 EDT 2012
Labels: WebSphere Cluster Status, Jython Script for Monitoring Cluster, IBM WebSphere Process Server, WebSphere Application Server