Advertisement
Guest User

Untitled

a guest
Sep 20th, 2010
5,787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.88 KB | None | 0 0
  1. #################################################################
  2. # This script will  get the jms attributes
  3. # Author : Prasanna Yalam
  4. # Updated by: Pavan Devarakonda
  5. #################################################################
  6.  
  7. from java.util import Date
  8.  
  9. ucf='ursec'
  10. ukf='urkey'
  11. admurl='t3://url'
  12. urldict={}
  13.  
  14. def conn():
  15. try:
  16.     connect(userConfigFile=ucf, userKeyFile=ukf, url=admurl)
  17. except ConnectionException,e:
  18.     print 'Unable to find admin server...'
  19.     exit()
  20. def initalize():
  21.     serverlist= ['app010','app011',...]
  22.     for svr in serverlist:
  23.     cd("/Servers/"+svr)
  24.     urldict[svr]='t3://'+get('ListenAddress')+':'+str(get('ListenPort'))
  25.  
  26. def JmsStat():
  27.     d = Date() # now
  28.     print  d
  29.  
  30.     print 'Instance         ConCur ConHi ConTot High  MsgCur MsgPnd'
  31.     print 'Name             Count  Count Count  Count Count  Count'
  32.     print '===========**=======**=================================='
  33.     Ks = urldict.keys()
  34.     Ks.sort()
  35.  
  36.     for key in Ks:
  37.         try:
  38.             connect(userConfigFile=ucf, userKeyFile=ukf,url=urldict[key])
  39.             serverRuntime()
  40.             cd('JMSRuntime/'+key+'.jms/JMSServers')
  41.             curCnt= get('ConnectionsCurrentCount')
  42.             cHiCnt=get('ConnectionsHighCount')
  43.             cTotCnt=get('ConnectionsTotalCount')
  44.  
  45.             myJmsls=ls(returnMap='true')
  46.             x=myJmsls[0]
  47.             cd(x)
  48.  
  49.             hiCnt= get('MessagesHighCount')
  50.             currCnt= get('MessagesCurrentCount')
  51.             pendCnt= get('MessagesPendingCount')
  52.             print '%14s   %4d   %4d  %4d  %4d  %4d  %4d' %  (key, curCnt, cHiCnt, cTotCnt,  hiCnt, currCnt, pendCnt)
  53.         except:
  54.             print 'Exception...in server:', key
  55.             pass
  56.     quit()
  57.  
  58. def quit():
  59.     d = Date() # now
  60.     print  d
  61.     print 'Hit any key to Re-RUN this script ...'
  62.     Ans = raw_input("Are you sure Quit from WLST... (y/n)")
  63.     if (Ans == 'y'):
  64.         disconnect()
  65.         stopRedirect()
  66.         exit()
  67. else:
  68.     JmsStat()
  69.  
  70. if __name__== "main":
  71.     redirect('./logs/jmsCnt.log', 'false')
  72.     conn()
  73.     initalize()
  74.     JmsStat()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement