Followers

Showing posts with label WLST. Show all posts
Showing posts with label WLST. Show all posts

Monday, June 8, 2015

Adding Gropus to GlobalRoles using WLST

WLST script 

connect('weblogic','weblogic1','t3://192.168.195.129:8001') 
serverConfig()
cd('/SecurityConfiguration/pocdomain/Realms/myrealm/RoleMappers/XACMLRoleMapper')
cmo.setRoleExpression(",'Admin','Grp(EnvAdmins)|Grp(Administrators)')

Thursday, February 5, 2015

MDS Export using WLST

1. Launch Weblogic Scripting Tool:
Weblogic_HOME/common/bin>wslt.cmd
2. Connect to weblogic:
connect('weblogic','welcome1','t3://localhost:7001')
3. Verify the list of all available commands:
help(all)
4. List all applications:
listApplications()
5. Check the syntax of the export Metadata command:
help('exportMetadata')
6. Execute the export
exportMetadata(application='soa-infra', server='soa_server1', toLocation='c:\\export')
Please note that on Windows both
toLocation='c:\\export') and toLocation='c:\export') (where the difference is one or two slashes after 'c:') will work.
However, toLocation='c:\export\my_export') will fail with the following error:
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "C:\WLS103~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 237, in exportMetadata
  File "C:\WLS103~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 733, in executeAppRuntimeMBeanOperation
  File "C:\WLS103~1\ORACLE~1\common\wlst\mdsWLSTCommands.py", line 996, in saveStackAndRaiseException
  WLSTException: MDS-90035: The target directory or archive "c:   ar\export" for exporting metadata is
 invalid.MDS-91009: Operation "exportMetadata" failure. Use dumpStack() to view the full stacktrace.
But, toLocation='c:\\export\\my_export') will work fine

Wednesday, October 29, 2014

Server Monitoring script

def reportDomainHealth(usern, passw, url):
print ""
print "===================================================================================="
connect(usern,passw,url)
domainRuntime()

print "Found Servers: "
serverList=ls('ServerRuntimes');
serverList=serverList.split()
print "%15s %15s %20s %15s %15s %40s" % ("Server","Threads","HoggingThreads","ServerState","Heap_Free","HealthState ")
print "----------------------------------------------------------------------------------------------------------------------------"
for i in range(len(serverList)):
if serverList[i] != 'dr--':
server_st=get('ServerRuntimes/' + serverList[i] + '/HealthState')
server_tc=get('ServerRuntimes/' + serverList[i] + '/ThreadPoolRuntime/ThreadPoolRuntime/ExecuteThreadTotalCount')
server_hog=get('ServerRuntimes/' + serverList[i] + '/ThreadPoolRuntime/ThreadPoolRuntime/HoggingThreadCount')
server_ql=get('ServerRuntimes/' + serverList[i] + '/State')
server_hpfp=get('ServerRuntimes/' + serverList[i] + '/JVMRuntime/' + serverList[i] + '/HeapFreePercent')
print "%15s %15s %20s %15s %15s %40s" % (serverList[i],str(server_tc),str(server_hog),str(server_ql),str(server_hpfp)+"%",str(server_st))
print "===================================================================================="


reportDomainHealth('weblogic','weblogic1','t3://localhost:7001')

Tuesday, June 24, 2014

Get Connection Pool Information through WLST

The below script will get information about JNDI,JDBC URL 

###################****##############****########################  
# Generic script applicable on any Operating Environments (Unix, Windows)  
# ScriptName    : togetConnectionpoolURL.py  
# Author        : Madhusudhana Chilipi  
###############     Connecting to Start     #################################  

connect('weblogic','welcome1','t3://192.168.1.2:7001')


###############     Changing the Datasources     #################################  

allJDBCResources = cmo.getJDBCSystemResources()
for jdbcResource in allJDBCResources:
   dsname = jdbcResource.getName()
   print dsname, jdbcResource.getJDBCResource().getJDBCDataSourceParams().getJNDINames()[0], jdbcResource.getJDBCResource().getJDBCDriverParams().getUrl() 

###############     End    ################################# 

Tuesday, January 28, 2014

WLST script for Dynamic Cluster creation in weblgoic

# This example demonstrates the WLST commands needed to create a dynamic cluster#
(dynamic-cluster). The dynamic cluster utilizes a server template
# dynamic-cluster-server-template. To keep this example simple, error handling# was omitted.#
connect()
edit()
startEdit()
## Create the server template for the dynamic servers and set the attributes for# the dynamic servers. Setting the cluster is not required.#
dynamicServerTemplate=cmo.createServerTemplate("dynamic-cluster-server-template")
dynamicServerTemplate.setAcceptBacklog(2000)
dynamicServerTemplate.setAutoRestart(true)
dynamicServerTemplate.setRestartMax(10)
dynamicServerTemplate.setStartupTimeout(600)
## Create the dynamic cluster and set the dynamicservers.#
dynCluster=cmo.createCluster("dynamic-cluster")
dynServers=dynCluster.getDynamicServers()
dynServers.setMaximumDynamicServerCount(10)
dynServers.setServerTemplate(dynamicServerTemplate)
## Dynamic server names will be dynamic-server-1, dynamic-server-2, ...,# dynamic-server-10.#
dynServers.setServerNamePrefix("dynamic-server-")
## Listen ports and machines assignments will be calculated. Using a round-robin#
algorithm, servers will be assigned to machines with names that start with#dyn-machine.#
dynServers.setCalculatedMachineNames(true)dynServers.setMachineNameMatchExpression("dyn-machine*")
## activate the changes#
activate()