2014년 4월 21일 월요일

weblogic wlst thread monitoring

from java.util import Date
from java.text import SimpleDateFormat

# Configured user credentials with storeUserConfig

def monitorThrds():
    connect("weblogic", "
pwd", "t3://IP:Port");
    serverNames = getRunningServerNames()
    domainRuntime()


    for i in range(10000):
        print '[' + SimpleDateFormat('d MMM yyyy HH:mm:ss').format(java.util.Date()) + ']'
        print '======================================================================'
        print '| Execute     Total    Idle    Pending     Hogging    Queue     StdBy'
        print '| QueueName   Count    Count    Count       Count     Length    Count'
        print '======================================================================'
        for sname in serverNames:
            try:
                cd("domainRuntime:/ServerRuntimes/" + sname.getName() + "/ThreadPoolRuntime/ThreadPoolRuntime")

                totcnt=get('ExecuteThreadTotalCount')
                idlecnt = get('ExecuteThreadIdleCount')
                pndcnt =get('PendingUserRequestCount')
                sevcnt = get('HoggingThreadCount')
                queuelength = get('QueueLength')
                stdbycnt = get('StandbyThreadCount')
                print '| %10s  %4d    %4d       %4d        %4d     %4d      %4d' %  (sname.getName(), totcnt, idlecnt, pndcnt, sevcnt, queuelength, stdbycnt)
            except WLSTException,e:
                # this typically means the server is not active, just ignore
                pass
        print '======================================================================'
        print ''
        import time
        time.sleep(3)

def getRunningServerNames():
        domainConfig()
        return cmo.getServers()

if __name__== "main":
    monitorThrds()
    disconnect()

댓글 없음:

댓글 쓰기