玩蛇网提供最新Python编程技术信息以及Python资源下载!

WLST WebLogic服务器监控脚本

python 培训

这是之前在网上看到的一段python代码,关于WLST WebLogic服务器监控脚本文章,如果你不能运行这个脚本,有可能是缩进的问题(因为转贴的过程中格式全都丢失了)。

username='madan'
password='******'
urldict={}
connect(username,password,'t3://kyarpt5q:9001')
serverlist=adminHome.getMBeansByType('Server')
for svr in serverlist:
urldict[svr.getName()]='t3://'+svr.getListenAddress()+':'+str(svr.getListenPort())
disconnect()

for svr,url in urldict.items():
try:
connect(username,password,url)
jvmrtlist=home.getMBeansByType('JVMRuntime')
print ' '
print ' ' 
print 'The Runtime Stats of Server: '+svr 
print ' '
print 'JVM'
print ' '
print 'FreeJVM TotalJVM UsedJVM' 
print ' '
for jvmRT in jvmrtlist:
freejvm = jvmRT.getAttribute("HeapFreeCurrent")
totaljvm = jvmRT.getAttribute("HeapSizeCurrent")
usedjvm = (totaljvm - freejvm)
print freejvm,' ',totaljvm,' ',usedjvm
print ' '


eqrtlist=home.getMBeansByType('ExecuteQueueRuntime')
print ' '
print ' '
print 'EXECUTE QUEUES'
print ' '
print 'ExecuteQueueName TotalCount CurrIdleCount PendRequestCurrCount ServicedRequestTotalCount'
print ' '
for eqRT in eqrtlist:
eqname = eqRT.getAttribute("Name")
eqtthreads = eqRT.getAttribute("ExecuteThreadTotalCount")
eqithreads = eqRT.getAttribute("ExecuteThreadCurrentIdleCount")
eqqc = eqRT.getAttribute("PendingRequestCurrentCount")
eqthrougp = eqRT.getAttribute("ServicedRequestTotalCount")
print eqname,' ',eqtthreads,' ',eqithreads,' ',eqqc,' ',eqthrougp
print ' '

poolrtlist=home.getMBeansByType('JDBCConnectionPoolRuntime')
print ' '
print ' '
print 'JDBC CONNECTION POOLS'
print ' '
print 'Name Maxcapacity ActiveCurrent ActiveHighCount WaitSecondsHighCount WaitingCurrentCount State'
print ' '
for poolRT in poolrtlist:
pname = poolRT.getName()
pmaxcapacity = poolRT.getAttribute("MaxCapacity")
paccc = poolRT.getAttribute("ActiveConnectionsCurrentCount")
pachc = poolRT.getAttribute("ActiveConnectionsHighCount")
pwshc = poolRT.getAttribute("WaitSecondsHighCount")
pwfccc = poolRT.getAttribute("WaitingForConnectionCurrentCount")
pstate = poolRT.getAttribute("State")
print pname,' ',pmaxcapacity,' ',paccc,' ',pachc,' ', pwshc,' ',pwfccc,' ',pstate
print ' '



jmsrtlist=home.getMBeansByType('JMSDestinationRuntime')
print ' '
print ' '
print 'JMS DESTINATIONS'
print ' '
print 'Name ByteCurr Pending Received High MsgCurr Pending High Received ConsumersTotal' 
print ' '
for jmsRT in jmsrtlist:
jmsname = jmsRT.getAttribute("Name")
jmsbcc = jmsRT.getAttribute("BytesCurrentCount")
jmsbpc = jmsRT.getAttribute("BytesPendingCount")
jmsbrc = jmsRT.getAttribute("BytesReceivedCount")
jmsbhc = jmsRT.getAttribute("BytesHighCount")
jmsmcc = jmsRT.getAttribute("MessagesCurrentCount")
jmsmpc = jmsRT.getAttribute("MessagesPendingCount")
jmsmhc = jmsRT.getAttribute("MessagesHighCount")
jmsmrc = jmsRT.getAttribute("MessagesReceivedCount")
jmsctc = jmsRT.getAttribute("ConsumersTotalCount")
print jmsname,' ',jmsbcc,' ',jmsbpc,' ',jmsbrc,' ',jmsbhc,' ',jmsmcc,' ',jmsmpc,' ',jmsmhc,' ', jmsmrc,' ',jmsctc
print ' '
#www.iplaypython.com

disconnect()
except:
print "Skipping "+svr
continue

玩蛇网原创,转载请注明文章出处和来源网址:http://www.iplaypython.com/code/other/o2413.html



微信公众号搜索"玩蛇网Python之家"加关注,每日最新的Python资讯、图文视频教程可以让你一手全掌握。强烈推荐关注!

微信扫描下图可直接关注

玩蛇网Python新手QQ群,欢迎加入: ① 240764603 玩蛇网Python新手群
文章发布日期:2016-04-12 15:16 玩蛇网 www.iplaypython.com

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
相关文章推荐
别人正在看
特别推荐
去顶部去底部