Infrastructure at your Service

Gérard Wisson

Java Virtual Machine Diagnostics: Starting/stopping JVMD manager

Although the managed server on which Java Virtual Machine Diagnostics (JVMD) manager is deployed is configured to use the the Node Manager like OMS and admin server, it is not started automatically with OMS. In this post, I will describe how to start JVMD manager automatically when the physical server boots.

To implement the script, several steps have to be executed:

  • Creation of a config file containing the encrypted password to connect to the NodeManager
  • Test the start/stop WLST commands
  • Creation of the python scripts
  • Creation of the init script

Config file creation

To avoid using a password in clear text, a config file containing the encrypted password will be created.
Set the MW_HOME environment variable.

export MW_HOME=/u01/app/oracle/Middleware

Create a script folder:
mkdir $MW_HOME/script

Connect to the NodeManager (in the example, nmpassword is the password to access the nodemanager):

source $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.WLST
nmConnect('nodemanager','nmpassword','vmtestoraem12c','7403','GCDomain','/u01/app/oracle/Middleware/gc_inst/user_projects/domains/GCDomain/','SSL')

Create files to avoid using the password in clear text:

storeUserConfig(userConfigFile='/u01/app/oracle/Middleware/script/userconfigNM.secure',userKeyFile='/u01/app/oracle/Middleware/script/userkeyNM.secure',nm='true')
nmDisconnect()

Test the encrypted password:

nmConnect(userConfigFile='/u01/app/oracle/Middleware/script/userconfigNM.secure',userKeyFile='/u01/app/oracle/Middleware/script/userkeyNM.secure', host='vmtestoraem12c', port='7403', domainName='GCDomain', domainDir='/u01/app/oracle/Middleware/gc_inst/user_projects/domains/GCDomain', nmType='SSL')

Test wlst start/stop command

Before creating a python script, test the start and stop commands:

nmStart('EMGC_JVMDMANAGER1')
nmKill(EMGC_JVMDMANAGER1')

Create the python scripts

The python scripts will be used to start and stop the WLS managed server where JVMD manager is deployed:
Start script:

# start_EMGC_JVMDMANAGER1.py 1.0 09/24/2012
#
# file: start_EMGC_JVMDMANAGER1.py
# purpose: start the EMGC_JVMDMANAGER WLS managed server because it is not sta
rted automatically by the emctl command
#
# Author: dbi_services (GWI)
# Version: 1.0 09/24/2012
#
############################################

# connect to the NodeManager using an encrypted file
nmConnect(userConfigFile='/u01/app/oracle/Middleware/script/userconfigNM.secure',userKeyFile='/u01/app/oracle/Middleware/script/userkeyNM.secure', host='vmtestoraem12c', port='7403', domainName='GCDomain', domainDir='/u01/app/oracle/Middleware/gc_inst/user_projects/domains/GCDomain', nmType='SSL')

# start the managed server
nmStart('EMGC_JVMDMANAGER1')

# disconnect from nodemanager
nmDisconnect()

Stop script:

# stop_EMGC_JVMDMANAGER1.py 1.0 09/24/2012
#
# file: stop_EMGC_JVMDMANAGER1.py
# purpose: stop the EMGC_JVMDMANAGER WLS managed server because it is not stopped automatically by the emctl command
#
# Author: dbi_services (GWI)
# Version: 1.0 09/24/2012
#
############################################

# connect to the NodeManager using an encrypted file
nmConnect(userConfigFile='/u01/app/oracle/Middleware/script/userconfigNM.secure',userKeyFile='/u01/app/oracle/Middleware/script/userkeyNM.secure', host='vmtestoraem12c', port='7403', domainName='GCDomain', domainDir='/u01/app/oracle/Middleware/gc_inst/user_projects/domains/GCDomain', nmType='SSL')

# stop the managed server
nmKill('EMGC_JVMDMANAGER1')

# disconnect from nodemanager
nmDisconnect()

Test the python scripts:

java weblogic.WLST /u01/app/oracle/Middleware/script/start_EMGC_JVMDMANAGER1.py
java weblogic.WLST /u01/app/oracle/Middleware/script/stop_EMGC_JVMDMANAGER1.py

Create an init script

Under /etc/init.d, create the jvmd script:

# jvmd.sh 1.0 09/24/2012
#
# file: jvmd
# purpose: start the EMGC_JVMDMANAGER WLS managed server because this is not sta
rted automatically by the emctl command
#
# Author: dbi_services (GWI)
# Version: 1.0 09/24/2012
#
# chkconfig:   345 85 15
############################################
###BEGIN INIT INFO
# Provides: jvmd
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: EMGC_JVMDMANAGER WLS managed server
# Description: Start and stop EMGC_JVMDMANAGER WLS managed server
### END INIT INFO
# set Weblogic environment defining CLASSPATH and LD_LIBRARY_PATH
# to start/stop various components.
export MW_HOME=/u01/app/oracle/Middleware
#
source $MW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh > /dev/null
SCRIPTDIR=$MW_HOME/script

start() {
echo "start EMGC_JVMDMANAGER1"
java weblogic.WLST $SCRIPTDIR/start_EMGC_JVMDMANAGER1.py
}

stop() {
echo "stop EMGC_JVMDMANAGER1"
java weblogic.WLST $SCRIPTDIR/stop_EMGC_JVMDMANAGER1.py
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo -n "Usage: $0 {start|stop}"
        exit 2
esac
exit $?

Change the permission:
chmod u+x jvmd

Create the link in the runlevel folder:
/sbin/chkconfig --add jvmd

Test the script:
/etc/rc3.d/S85jvmd start
/etc/rc3.d/S85jvmd stop

At the end, reboot your server and check if the JVMD manager is up and can be used through the OMS admin console.
In case you have to stop/start the OMS and JVMD, of course you can do it manually:

java weblogic.WLST /u01/app/oracle/Middleware/script/start_EMGC_JVMDMANAGER1.py
emctl stop oms -all

emctl start oms
java weblogic.WLST /u01/app/oracle/Middleware/script/stop_EMGC_JVMDMANAGER1.py

As JVMD manager can be installed on a WLS domain other than the OMS domain, I do not think Oracle will ever integrate the start/stop procedure in the OMS by changing the startOMS.py script.

 

Leave a Reply


× 9 = eighteen

Gérard Wisson
Gérard Wisson

Delivery Manager