There was an error in this gadget

Wednesday, September 28, 2011

Jython Script to check the Status of listener ports on all servers of cluster

lineSeparator = java.lang.System.getProperty('line.separator')

clusterName='CLUSTER_NAME'
cId = AdminConfig.getid("/ServerCluster:"+ clusterName +"/" )
cList = AdminConfig.list("ClusterMember", cId ).split(lineSeparator)
for sId in cList:
server = AdminConfig.showAttribute(sId, "memberName" )
node = AdminConfig.showAttribute(sId, "nodeName" )
cell = AdminControl.getCell()

s1 = AdminControl.completeObjectName('cell='+ cell +',node='+node +',name='+ server +',type=Server,*')
if len(s1) > 0:
print server + " state is started"
else:
print server + " is down"

print "Server " + server + " has the following Listener Ports"
lPorts = AdminControl.queryNames('type=ListenerPort,cell='+ cell+',node='+ node +',process='+ server +',*')
lPortsArray = lPorts.split(lineSeparator)
for lPort in lPortsArray:
lpcfgId = AdminControl.getConfigId(lPort)
lpName = AdminConfig.showAttribute(lpcfgId, "name")
lpstate = AdminControl.getAttribute(lPort, 'started')
if lpstate == 'true':
print lpName + " is started "
else :
print lpName + " is stopped "

print ""