Python Script to Monitor Weblogic Servers thru WLST

Python Script: (monitor.py)


def reportDomainHealth(usern, passw, url):
    print ""
    print "====================================================================="
    connect(usern,passw,url)
    domainRuntime()
     print "Found Servers: "
    serverList=ls('ServerRuntimes');
    serverList=serverList.split()
    print "%15s %15s %20s %15s %15s %40s" % ("Server","Threads","HoggingThreads","QueueLength","Heap_Free","HealthState ")
    print "----------------------------------------------------------------------------------------------------------------"
    for i in range(len(serverList)):
        if serverList[i] != 'dr--':
            server_st=get('ServerRuntimes/' + serverList[i] + '/HealthState')
            server_tc=get('ServerRuntimes/' + serverList[i] + '/ThreadPoolRuntime/ThreadPoolRuntime/ExecuteThreadTotalCount')
            server_hog=get('ServerRuntimes/' + serverList[i] + '/ThreadPoolRuntime/ThreadPoolRuntime/HoggingThreadCount')
            server_ql=get('ServerRuntimes/' + serverList[i] + '/ThreadPoolRuntime/ThreadPoolRuntime/QueueLength')
            server_hpfp=get('ServerRuntimes/' + serverList[i] + '/JVMRuntime/' + serverList[i] + '/HeapFreePercent')
            print "%15s %15s %20s %15s %15s %40s" % (serverList[i],str(server_tc),str(server_hog),str(server_ql),str(server_hpfp)+"%",str(server_st))
    print "================================================================="

reportDomainHealth('<WeblogicAdminUser>','<Password>','http://<hostname/IP Address of Weblogic Server>:<Port>')


Where:
WeblogicAdminUser  = Weblogic Admin console User
Passowrd = Weblogic Admin Console Password
Hostname / IP Address = Weblogic Admin Server host name / IP address
Port = Weblogic Admin Server listening Port
 ===============================================================

Execute the Script using WLST:
@ Windows:

<WLS_HOME>\common\bin\wlst.cmd  monitor.py


@Solaris:
<WLS_HOME>/common/bin/wlst.sh monitor.py

Where: WLS_HOME = Weblogic Server Installed directory. Ex: C:\bea\wlserver_10.0\

Comments

  1. Hi Prem,

    My setup -
    Operating System : RHEL-6
    WebLogic : wls_10.3.4.0

    I didnt face any problem while installing wls on rhel , and even created one sample domain successfully.

    But i was unable to start the AdminServer , it's throwing some error while starting

    Can you help me here?

    Note : I didnt touch anything with my-releam setting , just after creating one fresh sample domain.. tried starting it.


    - Unable to start AdminServer -

    #### <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1303829861499> <The realm "myrealm" failed to be loaded: weblogic.security.service.SecurityServiceException: java.lang.ExceptionInInitializerError.
    weblogic.security.service.SecurityServiceException: java.lang.ExceptionInInitializerError
    at weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:341)
    at weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:220)
    at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.InitializeServiceEngine(CommonSecurityServiceManagerDelegateImpl.java:1785)
    at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealm(CommonSecurityServiceManagerDelegateImpl.java:442)
    at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadRealm(CommonSecurityServiceManagerDelegateImpl.java:840)
    at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealms(CommonSecurityServiceManagerDelegateImpl.java:869)
    at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1030)
    at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:879)

    Let me know if you need any additional information

    Thanks
    Arun

    ReplyDelete

Post a Comment

Popular posts from this blog

Schedule OSB Service Using ESS 12c - SOA