Saturday 30 November 2013

Some useful commands to modify JVM, thread pool, Process Execution and MonitoringPolicy attributes

lineSeparator = java.lang.System.getProperty('line.separator')
server = 'server1'
srv=AdminConfig.getid('/Server:' + server)
#java Virtual Machine properties(init heap,Max heap etc....
jvmid = AdminConfig.list("JavaVirtualMachine", srv)
print jvmid
inith = ['initialHeapSize',1200]
maxh = ['maximumHeapSize',1300]
ver = ['verboseModeGarbageCollection','true']

attr = [inith,maxh,ver]
AdminConfig.modify(jvmid,attr)
AdminConfig.save()
####################
#process Execution        #
####################
process = AdminConfig.list('JavaProcessDef', srv)
print process
ex = AdminConfig.showAttribute(process,'execution')
AdminConfig.modify(ex, [['processPriority', 30],['runAsGroup', ['srini']],['runAsUser', ['yaganti']],['runInProcessGroup', 5],['umask', 022]])
AdminConfig.save()
####################################
#MonitoringPolicy attributes.....                      #
####################################
mp = AdminConfig.showAttribute(process,'monitoringPolicy')
AdminConfig.modify(mp,[['autoRestart', 'false'],['maximumStartupAttempts',5],['nodeRestartState', 'STOPPED'],['pingInterval',600],['pingTimeout',3000]])
AdminConfig.save()
#########################
#JVM Custom Properties         #
#########################
na = ['name', 'ALLCORP_CONFIG_SERVER_NAME']
val = ['value', 'DEV/AGENCY']
desc = ['description', 'Configuration Name']

jvmcpattrs = [na,val,desc]
AdminConfig.create("Property", jvmid, jvmcpattrs)
AdminConfig.save()
############################
#JVM Thread pool update             #
############################
thpid = AdminConfig.list('ThreadPool',srv).split(lineSeparator)
print thpid

for pool in thpid:
    print pool
    name='WebContainer'
    #if (thpid == name):
    if (pool.find("WebContainer") != -1):
        print "hello"
        AdminConfig.modify(pool,[['maximumSize', 100]])
        AdminConfig.save()
   
   




Sunday 10 November 2013

To encode passwords in properties files Using the PropFilePasswordEncoder script.

PropFilePasswordEncoder fileName { passwordPropertiesList | -SAS } [ -profileName profile ] [ -help | -? ]

Parameters

fileName
This required parameter specifies the name of file in which passwords are encoded.

passwordPropertiesList
This parameter is required if you are encoding passwords in the soap.client.props file. Specify a one or more password properties that you want to encode.

-SAS
This parameter is required if you are encoding passwords in the sas.client.props file.

-profileName
This is an optional parameter. The value profile specifies an application server profile name. The script uses the password encoding algorithm that it retrieves from the specified profile. If you do not specify this parameter, the script uses the default profile.

-help or -?
If you specify this parameter, the script ignores all other parameters and displays usage text.

Example

C:\IBM\WebSphere\AppServer\profiles\AppSrv01\bin\PropFilePasswordEncoder.bat "C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\Dmgr01\properties"\soap.client.props com.ibm.SOAP.loginPassword

Below is the Output

com.ibm.SOAP.loginUserid=Test1
com.ibm.SOAP.loginPassword={xor}DwwcazsybjE=
Commands for the AdimApp , AdminConfig , AdminControl and AdminTask

AdminApp
AdminConfig
AdminControl
AdminTask
deleteUserAndGroupEntries
edit
editInteractive
export
exportDDL
exportFile
getDeployStatus
help
install
installInteractive
isAppReady
list
listModules
options
publishWSDL
searchJNDIReferences
taskInfo
uninstall
update
updateAccessIDs
updateInteractive
view





attributes
checkin
convertToCluster
create
createClusterMember
createDocument
createUsingTemplate
defaults
deleteDocument
existsDocument
extract
getCrossDocumentValidationEnabled
getid
getObjectName
getObjectType
getSaveMode
getValidationLevel
getValidationSeverityResult
hasChanges
help
installResourceAdapter
list
listTemplates
modify
parents
queryChanges
remove
required
reset
resetAttributes
save
setCrossDocumentValidationEnabled
setSaveMode
setValidationLevel
show
showall
showAttribute
types
uninstallResourceAdapter
unsetAttributes
validate

completeObjectName
getAttribute
getAttribute_jmx
getAttributes
getAttributes_jmx
getCell
getConfigId
getDefaultDomain
getDomainName
getHost
getMBeanCount
getMBeanInfo_jmx
getNode
getObjectInstance
getPort
getPropertiesForDataSource (Deprecated)
getType
help
invoke
invoke_jmx
isRegistered
isRegistered_jmx
makeObjectName
queryMBeans
queryNames
queryNames_jmx
reconnect
setAttribute
setAttribute_jmx
setAttributes
setAttributes_jmx
testConnection
trace

createTCPEndPoint
getTCPEndPoint
help
listTCPEndPoints
listTCPThreadPools
updateAppOnCluster





Enabling Verbose garbage collection for Server at server level

server_id = AdminConfig.getid('/Cell:' + cellName + '/Node:' + nodename + '/Server:' + serverName)
jvm = AdminConfig.list('JavaVirtualMachine', server_id)
AdminConfig.modify(jvm, [['verboseModeGarbageCollection', 'true']])
Procedure to Backing up Websphere Application Profiles

Open the command prompt.
Browse to the <was_home>\bin directory. For example, you can type the following: cd <was_home>\bin For example:
cd c:\Program Files\IBM\WebSphere\AppServer\bin

Use the WebSphere Application Server manageprofiles command with the backupProfile parameter.
manageprofiles.bat -backupProfile -profileName <profile_name> -backupFile <backupFile_name>

Stand-alone

manageprofiles.bat -backupProfile -profileName AppSrv01 -backupFile c:\backup\AppSrv01.zip
for example

C:\ProgramFiles\IBM\WebSphere\AppServer\profiles\AppSrv01\bin>backupConfig.bat C:\was-setup\AppSrv01_backup.zip -logfile backup.log

Network deployment

manageprofiles.bat -backupProfile -profileName Dmgr01 -backupFile c:\backup\Dmgr01.zip


Parameters
The following options are available for the backupConfig command:

-nostop
Tells the backupConfig command not to stop the servers before backing up the configuration

-quiet
Suppresses the progress information that the backupConfig command prints in normal mode

-logfile file_name
Specifies the location of the log file to which trace information is written
By default, the log file is named backupConfig.log and is created in the logs directory.


-profileName profile_name
Defines the profile of the application server process in a multi-profile installation
The -profileName option is not required for running in a single-profile environment. The default for this option is the default profile.

-replacelog
Replaces the log file instead of appending to the current log

-trace
Generates trace information into the log file for debugging purposes

-username user_name
Specifies the user name for authentication if security is enabled in the server

-user user_name
Specifies the user name for authentication if security is enabled in the server; acts the same as the -username option

-password password
Specifies the password for authentication if security is enabled in the server

Friday 8 November 2013

Installing J2C resource adapter 

rarFilename = C:\Users\Administrator\Downloads\\activemq-rar-5.8.0.rar
resourceAdaptername = ActiveMQ JMS Resource Adapter_58

Rardesatt = ['rar.desc', 'ActiveMQ JMS Resource Adapter_58']
RararchivePathatt = ['rar.archivePath', '${CONNECTOR_INSTALL_ROOT}/activemq-rar-5.8.0.rar']
Rarclasspathatt = ['rar.classpath','${CONNECTOR_INSTALL_ROOT}/activemq-rar-5.8.0.rar']



resourceAtts=[Rardesatt,RararchivePathatt,Rarclasspathatt]


createJ2C = AdminJ2C.installJ2CResourceAdapter(nodename,rarFilename,resourceAdaptername,resourceAtts)
AdminConfig.save()
Jython Script to Modify Oracle JDBC driver Path

import sys, java
import java.util as util
import java.io as javaio
import re
import time
from time import sleep

cell=AdminControl.getCell()

JDBCProvider='Oracle JDBC Driver'
JDBCCell=AdminConfig.getid('/Cell:' + cell + '/JDBCProvider:' + JDBCProvider)

print JDBCCell
counter = 0
correctOraclePath="${ORACLE_JDBC_DRIVER_PATH}/ojdbc14.jar"
providerList = JDBCCell.split("\n")
print providerList
for providerID in providerList:
if (providerID.find("Oracle JDBC Driver") != -1):
jdbcProviderId = AdminConfig.getid( '/Cell:' + cell + '/JDBCProvider:Oracle JDBC Driver/')
classpathAttribute = AdminConfig.showAttribute(jdbcProviderId, 'classpath')
if ( classpathAttribute == correctOraclePath ):

print "%-11s %s" % (" ", "The variable is already correct: " + classpathAttribute  + "  for the CELL " + cell + "\n" )
            #break
else:
print ("\n MODIFYING THE JDBC CONFIGURATION at CELL LEVEL")
print "%-11s %s" % (" ", "\n Before: " + classpathAttribute  + "  for the CELL " + cell +"\n" )
AdminConfig.modify(jdbcProviderId, [['classpath', '' ]])
AdminConfig.modify(jdbcProviderId, [['classpath', correctOraclePath ]])
classpathAttribute = AdminConfig.showAttribute(jdbcProviderId, 'classpath')
#print "After: " + classpathAttribute  + "for the " + serverlist
print "%-11s %s" % (" ", "--------------------------------------------------------------------------------------\n")
print "%-11s %s" % (" ", "\n After: " + classpathAttribute  + "  for the CELL" + cell +"\n" )
print "%-11s %s" % (" ", "--------------------------------------------------------------------------------------\n")
AdminConfig.save()
print "%-11s %s" % (" ", "----------------------------------------------------------------------------------------\n")
print "%-11s %s" % (" ", " JDBC Provider Modified Successfully Completed for the CELL" + cell + "...\n")
print "%-11s %s" % (" ", "----------------------------------------------------------------------------------------\n")

#endElse
#endFor