Archive

Archive for the ‘WLST’ Category

转:Enabling and Disabling Weblogic Admin Console

January 26th, 2011 tonyxu No comments

转自:http://weblogic-wonders.com/weblogic/2011/01/25/enabling-and-disabling-weblogic-admin-console/

作者:SHANKAR

Disabling and Enabling Admin Console

Many at times for most of our administration work including the changes (deployments, start/stop of servers, etc) or configurations (JMS, creation/deletion/editing of our servers, etc) we use our weblogic admin console.

But, for security reasons some of the banking companies for its core banking applications prefer to disable the admin console in its banking applications.

This short and sweet article mainly targets to present you on how to enable and disable your admin console:

Disabling your Admin Console:

We can disable our weblogic admin console in two different ways

1)      Admin console

2)      Weblogic Scripting Tool

From Admin console:-

To disable access to the Administration Console:

  1. After you log in to admin console click Lock & Edit.
  2. In the left pane of the Console, under Domain Structure, select the domain name.
  3. Select Configuration > General, and click Advanced at the bottom of the page.
  4. Deselect Console Enabled.
  5. Click Save.
  6. To activate these changes, click Activate Changes.

From WLST:-

connect(“weblogic“,”weblogic“,”t3://localhost:7001“)

edit()

startEdit()

cmo.setConsoleEnabled(false)

save()

activate()

disconnect()

exit()

Enabling the Admin Console:

After we disable the admin console we can enable it again by using WLST.

Following are the steps on the same:

connect(“weblogic“,”weblogic“,”t3://localhost:7001“)

edit()

startEdit()

cmo.setConsoleEnabled(true)

save()

activate()

disconnect()

exit()

Note: Here,

1)      weblogic and weblogic are the user id and password of admin console.

2)      t3://localhost:7001 is the admin console URL

3)      After we enable/disable the admin console RESTART your admin server

Categories: WLST, weblogic Tags: ,

转:监控WLS 的py脚本

December 11th, 2010 tonyxu No comments

转自:http://fm928.blog.163.com/blog/static/748135201011944636522/

作则:fm928

下面是一个py脚本,主要可以监控WLS的资源,HEAP JVM JMS。。。,我这主要是监控JMS的东西,把其他注释掉了,如需要打开注释
即可:
# WLST WebLogic Server Monitoring Script
# Author: Madan M Noru
# Update by: Botao Zheng
# This script can be used to monitor JVM, EXECUTE QUEUE, JDBC and JMS Resources
# of all the WebLogic Instances running in a domain.
# NOTE: If you are unable to run this script, it could be an indentation problem. Please post your E-mail Id, I can send you the script.
import time
#Now = time.localtime(time.time())
Now = time.strftime(‘%Y%m%d-%H:%M:%S’,time.localtime(time.time()))
print Now
username=’weblogic’
password=’weblogic’
url=’t3://11.137.76.80:7791′
urldict={}
connect(username,password,url)
serverlist=adminHome.getMBeansByType(‘Server’)
print serverlist
for svr in serverlist:
#urldict['' + svr.getName() + ''] = str(svr.getListenPort())
        urldict[svr.getName()]=’t3://’+svr.getListenAddress()+’:'+str(svr.getListenPort())
disconnect()
for svr,url in urldict.items():
        try:
                connect(‘weblogic’,'weblogic’,'t3://11.137.76.80:7791′)
                jvmrtlist=home.getMBeansByType(‘JVMRuntime’)
                print jvmrtlist
                print ‘ ‘
                print ‘ ‘
                print ‘The Runtime Stats of Server: ‘+svr
                print ‘ ‘
                print ‘…………..::::::JVM::::::…………….’
                print ‘ ‘
                print ‘FreeJVM TotalJVM UsedJVM’
                print ‘ ‘
                for jvmRT in jvmrtlist:
                        freejvm = jvmRT.getAttribute("HeapFreeCurrent")
                        totaljvm = jvmRT.getAttribute("HeapSizeCurrent")
                        usedjvm = (totaljvm – freejvm)
                        print freejvm,’ ‘,totaljvm,’ ‘,usedjvm
                        print ‘ ‘
                        print ‘————————————————’
                        #time.sleep(5)
#               eqrtlist=home.getMBeansByType(‘ExecuteQueueRuntime’)
#               print ‘ ‘
#               print ‘ ‘
#               print ‘EXECUTE QUEUES’
#               print ‘ ‘
#               print ‘ExecuteQueueName TotalCount CurrIdleCount PendRequestCurrCount ServicedRequestTotalCount’
#               print ‘ ‘
#               for eqRT in eqrtlist:
#                       eqname = eqRT.getAttribute("Name")
#                       eqtthreads = eqRT.getAttribute("ExecuteThreadTotalCount")
#                       eqithreads = eqRT.getAttribute("ExecuteThreadCurrentIdleCount")
#                       eqqc = eqRT.getAttribute("PendingRequestCurrentCount")
#                       eqthrougp = eqRT.getAttribute("ServicedRequestTotalCount")
#                       print eqname,’ ‘,eqtthreads,’ ‘,eqithreads,’ ‘,eqqc,’ ‘,eqthrougp
#                       print ‘ ‘
#             
#下面注释是去掉JDBC和domainRuntime thre监控
                #poolrtlist=home.getMBeansByType(‘JDBCConnectionPoolRuntime’)
                #print ‘ ‘
                #print ‘ ‘
                #print ‘JDBC CONNECTION POOLS’
                #print ‘ ‘
                #print ‘Name Maxcapacity ActiveCurrent ActiveHighCount WaitSecondsHighCount WaitingCurrentCount State’
                #print ‘ ‘
                #for poolRT in poolrtlist:
                #        pname = poolRT.getName()
                #        pmaxcapacity = poolRT.getAttribute("MaxCapacity")
                 #       paccc = poolRT.getAttribute("ActiveConnectionsCurrentCount")
                 #       pachc = poolRT.getAttribute("ActiveConnectionsHighCount")
                 #       pwshc = poolRT.getAttribute("WaitSecondsHighCount")
                #        pwfccc = poolRT.getAttribute("WaitingForConnectionCurrentCount")
                 #       pstate = poolRT.getAttribute("State")
                 #       print pname,’ ‘,pmaxcapacity,’ ‘,paccc,’ ‘,pachc,’ ‘, pwshc,’ ‘,pwfccc,’ ‘,pstate
                  #      print ‘ ‘
                  #      print ‘————————————————————-’
                #domainRuntime()                                                           
                #cd(‘ServerRuntimes/’+svr+’/WorkManagerRuntimes/weblogic.kernel.Default’)
                #cd(‘ServerRuntimes/’+svr+’/ThreadPoolRuntime/ThreadPoolRuntime’)
                #print ls()                                                                
                print ‘—————————————————————–’
                jmsrtlist=home.getMBeansByType(‘JMSDestinationRuntime’)
                print ‘ ‘
                print ‘ ‘
                print ‘…………..::::::JMS DESTINATIONS::::::…………….’
                print ‘ ‘
                print ‘Now Time:’,Now
                print ‘-=-=-=-=-=-=-=-=-=-=-=-=-=Name——-MsgCurr–Pending–High–Received–ConsumersTotal–ConsumersHigh’
                print ‘ ‘
                for jmsRT in jmsrtlist:
                        jmsname = jmsRT.getAttribute("Name")
                        jmschc = jmsRT.getAttribute("ConsumersHighCount")
                        jmsbcc = jmsRT.getAttribute("BytesCurrentCount")
                        jmsbpc = jmsRT.getAttribute("BytesPendingCount")
                        jmsbrc = jmsRT.getAttribute("BytesReceivedCount")
                        jmsbhc = jmsRT.getAttribute("BytesHighCount")
                        jmsmcc = jmsRT.getAttribute("MessagesCurrentCount")
                        jmsmpc = jmsRT.getAttribute("MessagesPendingCount")
                        jmsmhc = jmsRT.getAttribute("MessagesHighCount")
                        jmsmrc = jmsRT.getAttribute("MessagesReceivedCount")
                        jmsctc = jmsRT.getAttribute("ConsumersTotalCount")
                        #print jmsname,’|',jmsbcc,’ ‘,jmsbpc,’ ‘,jmsbrc,’ ‘,jmsbhc,’ ‘,jmsmcc,’ ‘,jmsmpc,’ ‘,jmsmhc,’ ‘, jmsmrc,’ ‘,jmsctc
                        print Now,”,jmsname,’——’,jmsmcc,’– ‘,jmsmpc,’– ‘,jmsmhc,’– ‘, jmsmrc,’– ‘,jmsctc,’–’,jmschc
                        print ‘ ‘
                        print ‘——————————————————————-’
                disconnect()
        except:
                print "Skipping "+svr
                continue

Categories: WLST, py, weblogic Tags: , , ,