Monday, August 31, 2009

Monitor in weblogic JMS servers using WLST script.

When we are using the weblogic JMS servers,
it’s very difficult for us to monitor the number of messages in JMS servers and number of pending messages JMS server. every time, when we need this information, we need to login to weblogic console and browse every JMS server in cluster. It very time consuming and tedious process.

We can use simple WLST script to avoid to login to WL console and get the statistics of JMS server. it’s very simple to use.

connect(username, password, url)

cd('/')
domainRuntime()

print '\n\nJMS Servers:\n'
for i in range(1,9):
cd('/')
cd('ServerRuntimes/' + ServerName.replace('', str(i)) +'/JMSRuntime/' + ServerName.replace('', str(i)) + '.jms'+'/JMSServers/' + JMSServerName.replace('', str(i)))
print JMSServerName.replace('', str(i)) + '->' + str(get('MessagesCurrentCount')) + '->' + str(get('MessagesPendingCount'))

print '\n'


using above script. We can get the number of messages in current and number of message in pending in all the JMS servers in a cluster.