Hi,

Jay SenSharma

Jay SenSharma

Many times we want to monitor the different modules available as part of our WebLogic Domain. WebLogic Scripting Tool (WLST) is one of the best utility which is based on Jython (The Java Version of Python Scripting) Option.

WLST not only allows to configure different resources in WebLogic Server/Domain as well as it allows a very easy way to monitor different resources available as part of WebLogic Server/Domain. We can monitor JMS/ DataSources/JDBC Parameters…etc using WLST.

Here we are going to see a very simple demonstration of using WLST to monitor Java Messaging Service (JMS) and the JMS Destination informations, which it holds, this part of monitoring includes both the Configuration Informations as well as the Runtime informations of the dataSource.

Step1). Create a WLST Script somewhere in your file system with some name like “Monitor_JMS.py”   inside “C:WLST_Jdbc”  contents will be something like following:

#############################################################################
#
# @author Copyright (c) 2010 - 2011 by Middleware Magic, All Rights Reserved.
#
#############################################################################

connect('weblogic','weblogic','t3://localhost:7001')
servers = domainRuntimeService.getServerRuntimes();
if (len(servers) > 0):
	for server in servers:
		jmsRuntime = server.getJMSRuntime();
		jmsServers = jmsRuntime.getJMSServers();
		for jmsServer in jmsServers:
			destinations = jmsServer.getDestinations();
			for destination in destinations:
				print '  BytesCurrentCount           ' ,  destination.getBytesCurrentCount()
				print '  BytesHighCount              ' ,  destination.getBytesHighCount()
				print '  BytesPendingCount           ' ,  destination.getBytesPendingCount()
				print '  BytesReceivedCount          ' ,  destination.getBytesReceivedCount()
				print '  BytesThresholdTime          ' ,  destination.getBytesThresholdTime()
				print '  ConsumersCurrentCount       ' ,  destination.getConsumersCurrentCount()
				print '  ConsumersHighCount          ' ,  destination.getConsumersHighCount()
				print '  ConsumersTotalCount         ' ,  destination.getConsumersTotalCount()
				print '  ConsumptionPausedState      ' ,  destination.getConsumptionPausedState()
				print '  '
				print '  DestinationInfo             ' ,  destination.getDestinationInfo()
				print '  '
				print '  DestinationType             ' ,  destination.getDestinationType()
				print '  InsertionPaused             ' ,  destination.isInsertionPaused()
				print '  InsertionPausedState        ' ,  destination.getInsertionPausedState()
				print '  MessagesCurrentCount        ' ,  destination.getMessagesCurrentCount()
				print '  MessagesDeletedCurrentCount ' ,  destination.getMessagesDeletedCurrentCount()
				print '  MessagesHighCount           ' ,  destination.getMessagesHighCount()
				print '  MessagesMovedCurrentCount   ' ,  destination.getMessagesMovedCurrentCount()
				print '  MessagesPendingCount        ' ,  destination.getMessagesPendingCount()
				print '  MessagesReceivedCount       ' ,  destination.getMessagesReceivedCount()
				print '  MessagesThresholdTime       ' ,  destination.getMessagesThresholdTime()
				print '  Parent                      ' ,  destination.getParent()
				print '  Paused                      ' ,  destination.isPaused()
				print '  ProductionPaused            ' ,  destination.isProductionPaused()
				print '  ProductionPausedState       ' ,  destination.getProductionPausedState()
				print '  State                       ' ,  destination.getState()
				print '  Type                        ' ,  destination.getType()

Step2). Start your WebLogic Server (Make sure that you have configured some JMS Server and JMS Modules in the Server to monitor). Or plesase refer to the following page to configure some JMS Resources like Queues/Topics:
http://middlewaremagic.com/weblogic/?page_id=1976

Step3). Open a command prompt and then run the “setWLSEnv.cmd” or “setWLSEnv.sh”  to set the CLASSPATH and PATH variables. Better you do echo %CLASSPATH%    or echo $CLASSPATH to see whether the CLASSPATH is set properly or not. If you see an Empty Classpath even after running the “setWLSEnv.sh” then please refer to the Note mentioned at Step3) in the Following post:   http://middlewaremagic.com/weblogic/?page_id=1492

Step4). Now run the WLST Script in the same command prompt like following:

java       weblogic.WLST        C:WLST_JdbcMonitor_JMS.py
You will see the following kind of results in the command prompt


  BytesCurrentCount            0
  BytesHighCount               0
  BytesPendingCount            0
  BytesReceivedCount           0
  BytesThresholdTime           0
  ConsumersCurrentCount        0
  ConsumersHighCount           0
  ConsumersTotalCount          0
  ConsumptionPausedState       Consumption-Enabled

  DestinationInfo              javax.management.openmbean.CompositeDataSupport(compositeType=javax.management.openmbean.CompositeType(name=DestinationInfo,items=((itemName=ApplicationName,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=ModuleName,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=Name,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=Queue,itemType=javax.management.openmbean.SimpleType(name=java.lang.Boolean)),(itemName=SerializedDestination,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=ServerName,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=Topic,itemType=javax.management.openmbean.SimpleType(name=java.lang.Boolean)),(itemName=VersionNumber,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer)))),contents={ApplicationName=TestSystemModule, ModuleName=null, Name=TestSystemModule!Test_Q, Queue=true, SerializedDestination=rO0ABXNyACN3ZWJsb2dpYy5qbXMuY29tbW9uLkRlc3RpbmF0aW9uSW1wbFSmyJ1qZfv8DAAAeHB3gbRBABdUZXN0U3lzdGVtTW9kdWxlIVRlc3RfUQANVGVzdEpNU1NlcnZlcgAQVGVzdFN5c3RlbU1vZHVsZQEAA0FsbAICD/TBLPfeTooAAAAKAQALQWRtaW5TZXJ2ZXIALYQaAg/0wSz33k6KAAAADAEAC0FkbWluU2VydmVyAC2EGng=, ServerName=TestJMSServer, Topic=false, VersionNumber=1})

  DestinationType              Queue
  InsertionPaused              0
  InsertionPausedState         Insertion-Enabled
  MessagesCurrentCount         0
  MessagesDeletedCurrentCount  0
  MessagesHighCount            0
  MessagesMovedCurrentCount    0
  MessagesPendingCount         0
  MessagesReceivedCount        0
  MessagesThresholdTime        0
  Name                         TestSystemModule!Test_Q
  Parent                       [MBeanServerInvocationHandler]com.bea:ServerRuntime=AdminServer,Name=TestJMSServer,Location=AdminServer,Type=JMSServerRuntime
  Paused                       0
  ProductionPaused             0
  ProductionPausedState        Production-Enabled
  State                        advertised_in_cluster_jndi
  Type                         JMSDestinationRuntime
JMS_Monitoring_Using_WLST

JMS_Monitoring_Using_WLST

.

.

Thanks

Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.