Search This Blog

Thursday, April 30, 2009

WLST Thread Count

WLST Thread Count in WebLogic 9.x and all higher version the Thread model is depends on WorkManager. The WorkManager internally uses self-tuning threads for each WebLogic Server instances.
-->

To get the thread Model and its Idle count as in the WebLogic 8.1 we need to tune the server instance parameter in the config.xml. While changing this you should be cautious,

 make sure you have  a backup copy the config.xml before editing.
Enter the following line in the child element, given same level as element.






Full detail description about how to change this parameter is given here...
http://download.oracle.com/docs/cd/E13222_01/wls/docs92/perform/appb_queues.html

The WLST script for Thread count monitoring will be as follows: 



######################################################
# This script is used to monitor all servers
# Author: Pavan Devarakonda
# Date:   28th April 2009
######################################################
import thread
 
# Configured user credentials with storeUserConfig
 
 ucf='keypath/xuserconfig.key'
 ukf='keypath/xkeyfile.key'
 admurl = "t3://hostingdns.com:port"
  
 def monitorThrds():
     connect(userConfigFile=ucf, userKeyFile=ukf, url= admurl )
     serverNames = getRunningServerNames()
     domainRuntime()
     print 'EXECUTE QUEUES'
     print ' '
     print 'Execute   Total  Current   PendRequest ServicedRequest'
     print 'QueueName Count  IdleCount CurrCount   TotalCount '
     print '===========**=======**=================================='
     for snam in serverNames:
         try:
                 cd("/ServerRuntimes/" + snam.getName() + "/ExecuteQueueRuntimes/weblogic.kernel.Default") 
                 totcnt=get('ExecuteThreadTotalCount') 
                 idlecnt = get('ExecuteThreadCurrentIdleCount')
                 pndcnt =get('PendingRequestCurrentCount') 
                 sevcnt = get('ServicedRequestTotalCount') 
                 print '%10s  %4d    %4d    %4d   %16d' %  (snam.getName(), totcnt, idlecnt, pndcnt, sevcnt) 
         except WLSTException,e:
                 # this typically means the server is not active, just ignore
                 pass
  
 def getRunningServerNames():
         domainConfig()
         return cmo.getServers()
  
 if __name__== "main":
     monitorThrds()
     disconnect()

Wednesday, April 22, 2009

JVM Monitoring with WLST

Hey dear WLAs, here I am with a new assignment for JVM monitoring. The fresh production environment setup with Clustered Domain with multiple physical locations with multiple UNIX machines.

The WebLogic capacity planning going on and various low memory or OutOfMemory issues araising when new migration happen from WebLogic 8.1 to 9.2 MP3. To identity how the Garbage Collection working? How much free memory is available for each instance? This can be known with JVM statistics, which inturn tuning the JVM parameters or reset is easy for decide.

I had found a JVM monitoring script that is best suites to my WebLogic environment.

This script is able to get all server instances JVM statistics with a single run. The beauty of WLST is that it runs on single JVM and provides us the required output with the help of domain, server Runtime MBeans, which are supported by WebLogic 9.x and later releases by default supporting JMX 1.2, which has many good features to control and monitor the Runtime Environment of a WebLogic Server instance.


Here have the script which I have modified as per my task there is little C-style customization done with Python language syntax. I mean in Jython which actally used in the WLST.


This could be further refined but ... short of time I am pubishing this
Enjoy!!! Jython/WLST SCRIPTING

#You can create key files
ucf='keypath/xuserconfig.key'
ukf='keypath/xkeyfile.key'
admurl = "t3://hostingdns.com:port"

# This module is for retrieve the JVM statistics
def monitorJVMHeapSize():
     connect(userConfigFile=ucf, userKeyFile=ukf, url=admurl)
     # alternate connect('user', 'passwd', 'adminurl')
     serverNames = getRunningServerNames()
     domainRuntime()

     print '                TotalJVM  FreeJVM  Used JVM' 
     print '=============================================='
     for name in serverNames:
   try:
    cd("/ServerRuntimes/"+name.getName()+"/JVMRuntime/"+name.getName())
    freejvm = int(get('HeapFreeCurrent'))/(1024*1024)
    totaljvm = int(get('HeapSizeCurrent'))/(1024*1024)
    usedjvm = (totaljvm - freejvm)
    print '%14s  %4d MB   %4d MB   %4d MB ' %  (name.getName(),totaljvm, freejvm, usedjvm)
   except WLSTException,e:
     pass

# This module for managed Servers list
def getRunningServerNames():
     domainConfig()
     return cmo.getServers()
 
if __name__== "main":
     monitorJVMHeapSize()
     disconnect()

Here in this program you can add more functionality with getting the HeapFreePercent. It is just a variable assigned with get('HeapFreePercent') . Later, You can print that variable value.

Popular Posts