`

Python实现的weblogic监控

    博客分类:
  • java
 
阅读更多

利用WLST调用对weblogic server进行监控,Python实现。
# WLST WebLogic Server Monitoring Script
# Author: Madan M Noru
# This script can be used to monitor JVM, EXECUTE QUEUE, JDBC and JMS Resources
# of all the WebLogic Instances running in a domain.

# NOTE: If you are unable to run this script, it could be an indentation problem. Please post your E-mail Id, I can send you the script.
import time
Now = time.localtime(time.time())[6]
print Now
username='eprm'
password='eprm123456'
url='t3://134.96.101.9:8001'
urldict={}
connect(username,password,url)
serverlist=adminHome.getMBeansByType('Server')
print serverlist

for svr in serverlist:
#urldict['' + svr.getName() + ''] = str(svr.getListenPort())
        urldict[svr.getName()]='t3://'+svr.getListenAddress()+':'+str(svr.getListenPort())
disconnect()

for svr,url in urldict.items():
        try:
                connect('eprm','eprm123456','t3://134.96.101.9:8001')
                jvmrtlist=home.getMBeansByType('JVMRuntime')
                print jvmrtlist
                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 ' '
                        print '------------------------------------------------'
                        #time.sleep(5)

#注释掉部分为执行队列的监控
#               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 ' '
                        print '-------------------------------------------------------------'

                domainRuntime()                                                             
                #cd('ServerRuntimes/'+svr+'/WorkManagerRuntimes/weblogic.kernel.Default')
                cd('ServerRuntimes/'+svr+'/ThreadPoolRuntime/ThreadPoolRuntime')
                print ls()                                                                  
                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,' ',j
msctc
                        print ' '
                        print '-------------------------------------------------------------------'
                disconnect()
        except:
                print "Skipping "+svr
                continue

分享到:
评论

相关推荐

    weblogic监控脚本

    这篇博客文章“Weblogic监控脚本”可能涉及了如何利用脚本来自动化监控WebLogic服务器的关键指标,如内存使用、CPU利用率、JVM性能等。 在WebLogic中,监控可以通过多种方式实现,包括使用内置的管理控制台、WLST...

    weblogic反序列化漏洞验证脚本(python版)对4.18最新漏洞检测

    该标题提及的是一个针对WebLogic的Python脚本,用于检测版本4.18的最新反序列化漏洞。这个脚本,名为`weblogic_poc2628.py`,是漏洞验证工具,它可以帮助安全研究人员或管理员检测其WebLogic服务器是否易受这种特定...

    shell方式重启weblogic

    WLST是一个基于Python的命令行工具,用于配置、管理和监控WebLogic Server;Admin Console是WebLogic提供的图形界面,用户可以通过浏览器访问进行管理操作;Node Manager则用于远程启动和停止WebLogic Server实例。 ...

    WebLogic企业级运维实战

    通过使用脚本语言(如Perl、Python或bash)和Ant、Maven等构建工具,可以实现WebLogic的自动化部署、更新和备份。 八、持续集成与持续交付 结合Jenkins、Git等工具,WebLogic运维可以实现应用的持续集成和持续交付...

    bea weblogic server script tool

    WebLogic Scripting Tool(WLST)是BEA WebLogic Server提供的核心管理工具之一,通过Python脚本语言实现了对WebLogic Server的自动化管理。从创建域、配置服务器到监控性能,WLST覆盖了WebLogic Server管理的各个...

    weblogic 详细配置手册

    1. `wlst`(WebLogic Scripting Tool):基于Python的命令行工具,用于脚本化地执行WebLogic Server的管理和配置任务。 2. `startWebLogic.sh`/`startWebLogic.cmd`:启动WebLogic Server实例。 3. `stopWebLogic....

    weblogic自动化管理脚本

    WLST是WebLogic Server的一个内置工具,它提供了一种基于Python的交互式和脚本化的环境,用于配置、管理和监控WebLogic域。WLST允许用户通过命令行界面或脚本文件执行各种操作,如创建、修改和查询WebLogic Server的...

    weblogic 了解域配置

    WebLogic Server是一款由甲骨文公司提供的企业级Java应用程序服务器,是Java EE平台的重要实现。在WebLogic中,“域”是管理和配置WebLogic Server实例、集群、数据源、JMS队列等各种服务和资源的基本单位。本文将...

    WebLogic培训资料(迄今所发现的最好学习资料)

    - **WLST(WebLogic Scripting Tool)**:一种基于Python的命令行工具,用于自动化WebLogic的配置、管理和监控。 - **WebLogic控制台**:基于Web的图形用户界面,用于配置和管理域、服务器和应用程序。 - **监控...

    weblogic10 api

    2. **管理API**:WLST(WebLogic Scripting Tool)提供了一套基于Python的命令行工具,允许管理员通过脚本自动化管理WebLogic Server实例。此外,JMX(Java Management Extensions)API则为程序提供了监控和管理...

    WebLogic Plugin

    - **服务器视图**:提供了一个可视化的WebLogic Server管理界面,用户可以查看、启动、停止和监控服务器实例。 - **应用程序部署**:支持在Eclipse内直接部署、更新和卸载应用,简化了开发和测试流程。 - **集成...

    OSB 搭建指南

    OSB 提供了一种集中式的平台,能够处理服务的生命周期,包括设计、实施、测试、监控和管理。以下是一份详细的 OSB 搭建指南,涵盖了从安装到实践操作的各个步骤。 **练习一:Oracle Service Bus 的安装** 安装 OSB...

    weblogic 11g 64位 各版本

    - **WLST(WebLogic Scripting Tool)**:基于Python的命令行工具,用于自动化部署和管理WebLogic Server。 - **Admin Console**:图形化界面,用于监控和管理WebLogic Server实例,如启动、停止、部署应用等。 6...

    unix下的weblogic安装和使用

    `wlst`是一个交互式的Python脚本环境,用于创建、修改和管理WebLogic资源。 总的来说,Unix下的WebLogic安装和使用涉及众多细节,需要对Unix操作系统、WebLogic Server以及Java EE有一定的理解和实践经验。一旦掌握...

    WebLogic服务器管理概述

    WebLogic服务器管理是Oracle公司提供的一个企业级Java应用服务器,用于部署、管理和监控Java应用程序和服务。WebLogic服务器作为Java EE(现在称为Jakarta EE)平台的一部分,为开发和运行分布式多层应用程序提供了...

    weblogic 学习 笔记 ppt

    - **WLST(WebLogic Scripting Tool)**:使用Python语法的命令行工具,允许自动化执行WebLogic管理任务。 10. **WebLogic与云环境的整合** - **Oracle Cloud Infrastructure**:WebLogic可以在Oracle云环境中...

    WebLogic Scripting Tool (WLST) 介紹

    WLST 提供了一种基于Jython(Python的Java实现)的接口,用于操作WebLogic Domain的配置对象。它支持创建、查询、修改和删除域中的各种元素,如服务器、集群、数据源、JMS资源等。通过WLST,你可以执行如启动和停止...

    weblogic12c(12.1.1)

    11. **WebLogic Scripting Tool (WLST)**:提供了基于Python的脚本工具,用于自动化WebLogic的配置和管理任务。 12. **WebLogic Diagnostic Framework (WLDF)**:为监控、诊断和解决性能问题提供了强大的框架,包括...

    企业级weblogic应用第一章

    2. WLST(WebLogic Scripting Tool):使用Python脚本语言进行WebLogic配置和管理,适用于自动化任务。 3. JMX(Java Management Extensions):提供标准接口,允许集成第三方管理工具监控和管理WebLogic。 四、...

    WebLogic.9.10.Monitor.Performance.Tuning.zip

    1. WLST(WebLogic Scripting Tool):这是一个基于Python的命令行工具,用于自动化WebLogic Server的配置和管理,包括性能监控和调优。 2. JProfiler、VisualVM:这些第三方工具提供更深入的JVM分析,帮助找出内存...

Global site tag (gtag.js) - Google Analytics