Reputation: 1
I'm trying to create a script which will display all JVM status.
so far, i've created a script which basically calls serverStatus.sh and is then run from different hosts to get status of each JVM from different machines. then the script puts it in a text file in a shared file system. which is i know really sucks. i'm just wondering if there is a way like wlst.sh does the checking.
Example output:
Upvotes: 0
Views: 2163
Reputation: 113
If you are in an ND environment, you can use a wsadmin script to check status of Server MBean (see Server MBean - Javadoc).
Here is a code snippet that may be helpful.
nodes=AdminConfig.getid('/Node:/').splitlines()
nodenames=[ AdminConfig.showAttribute(node,'name') for node in nodes ]
j2eeServerTuples=[]
for nodename in nodenames:
serversString="/Node:%s/Server:/" % (nodename)
servers=AdminConfig.getid(serversString).splitlines()
for server in servers:
if AdminConfig.showAttribute(server,'serverType') in ['APPLICATION_SERVER','DEPLOYMENT_MANAGER','NODE_AGENT'] :
j2eeServerTuples.append( (nodename, AdminConfig.showAttribute(server,'name')) )
for (nodename,servername) in j2eeServerTuples:
mBeanString = 'WebSphere:*,name=%s,type=Server,j2eeType=J2EEServer,node=%s' % (servername, nodename)
serverMBean = AdminControl.queryNames(mBeanString)
if (len(serverMBean) == 0):
(state, pid) = ("UNREACHABLE", "-----")
else:
(state, pid) = (AdminControl.getAttribute(serverMBean,'state'), AdminControl.getAttribute(serverMBean,'pid'))
print "%20s: %-30s => %15s : %s" % ( nodename, servername, state, pid)
Some tips of the above script.
Upvotes: 3