Generate configuration scripts from console with WLSTScriptGenerator

* Have you ever wondered if you could record all your configuration steps that you went through via the console to setup your domain and play the recorded steps to configure the same resources in different domains?

* Have you ever wondered what JMX MBean you are changing when you are clicking a checkbox in the console?

* Have you ever wondered if you could audit all the changes to your configuration (the user who started the edit session, at what time and the user who closed the edit session and at what time) ?

If your answer is Yes to any of the questions above, WLSTScriptGenerator is for you. If you never used WLST and would like to automate some WLS Administration tasks, you should start off with WLSTScriptGenerator.

Many 9.0 WebLogic Administrators are hooked to the console (well, with the new look and feel, who wouldn’t be ;) ), but there are times where you would make a bunch of changes, go through different wizards, click different buttons and setup your domain. Now if you have to go through the same process every time you setup a domain, it is time consuming and error prone. WLSTScriptGenerator lets you create a script per each edit session, the generated script will contain all the WLST equivalent commands that you can use to make same changes. The script will also contain the username who started the edit sessiion and at what time and the time and username who activated the changes.
When you start your Administration Server with WLSTScriptGenerator in front of your classpath, it will intercept each JMX call that is made to the MBeanServer and converts any change to the MBeans to a WLST command and writes it to the script, its that simple.. :-) . So, any changes via straight JMX are also converted to a WLST Script, not just the changes from the console. All the generated scripts will be saved to (DOMAIN_DIR)/wlstScripts directory.
For example, I have started an Administration server, logged into the console, created a Managed server and set the listen port. Created a Cluster and assigned the Managed Server to the Cluster. Saved my changes and activated them. If I look under my domain_dir/wlstScripts I see a jmxToWlst.py and the script generated looks something like this.
“”"
@author Copyright (c) 2004 by BEA WebLogic. All Rights Reserved.
This script is being created as part of your console/wlst/jmx interactions.
You might have to tweak this script a little bit if you may find any syntax errors.
If you find any problems, please email Satya Ghattu at sghattu@bea.com
Script Generation Begin Time: Tue Aug 16 18:37:00 EDT 2005
“”"
edit()
startEdit(0,-1,’false’)

#Script Generation Started By: weblogic

cd(‘/’)
cmo.createServer(‘ms1′)
cd(‘/Servers/ms1′)
set(‘ListenPort’,’8001′)
cd(‘/’)
cmo.createCluster(‘mycluster’)
cd(‘/Servers/ms1′)
cmo.setCluster(getMBean(‘/Clusters/mycluster’))
activate()

“”"
Script Generation Ended By: weblogic
Script Generation End Time: Tue Aug 16 18:37:52 EDT 2005
“”"

By default the scripts are always generated for every edit session when you have the wlstScriptGenerator.jar in your classpath. To disable the script generation, fire up a WLST session and connect to the Administration Server and,
edit()
startEdit()
mbs.setAttribute(ObjectName(‘com.bea:Name=WLST,Type=WLST’), Attribute(‘Recording’,'false’))
activate()

To re-enable the script generation just set the ‘Recording’ attribute on the WLST MBean to ‘true’.

I hope WLSTScriptGenerator lets you get a jump start on using WLST and help you automate your daily WebLogic Administration tasks.

_uacct = “UA-2684269-2″;
urchinTracker();

5 Responses to “Generate configuration scripts from console with WLSTScriptGenerator”

  1. Santu says:

    Hi satya

    I am following u r blog

    can u please post how to configure Apache Http 2.2 with weblogic 10.2 using WLST

  2. Lam Xuan says:

    i can’t run command:
    mbs.setAttribute(ObjectName(’com.bea:Name=WLST,Type=WLST’), Attribute(’Recording’,’false’))

  3. sghattu says:

    This may be because you have not deployed the script generator. Please check, also what error message do you see?

  4. Mike says:

    Where can I download WLSTScriptGenerator now that codesamples is offline?

  5. sghattu says:

    I recently started this google code project where I uploaded the script generator that will work with 9.x.
    http://wlst-archives.googlecode.com/files/wlstScriptGenerator_91.zip