Automating WLSDM Upgrade in Multiple Domains

WLSDM for WebLogic
WLSDM for WebLogic

--

The wlsdm update process is quite simple. wlsdm_agent.jar and wlsdm.war are replaced by new packages. The update steps are exactly as follows.

  1. Replace wlsdm_agent.jar file with the new release and keep wlsdm_agent.jar JVM arguments. *($JAVA_OPTIONS)
  2. Replace wlsdm.war file with the new release to WebLogic domain’s console-ext folder.
  3. (Re)start WebLogic managed server(s) then admin server.
  4. That’s all! WLSDM will be upgraded after restart processes.

For more Infomation : https://wlsdm.com/docs/README#VII.Upgrade&Reinstall&Uninstall

While the update steps are very simple, things can get a little more difficult as the number of domains increases. This can create an extra workload for you. In this blog post, we will focus on how to transfer wlsdm jar and war packages then subsequently restarting managed servers and admin servers through the central operation server. This scenario created consists of 2 steps.

  1. Distribute package to servers ( ./bulkScp.sh servers.csv).
  2. Restart managed servers over WLST if the server has WLSDM params. Then Restart Admin Server. If Admin Server has a machine, it will be over Node Manager, otherwise we’ll connect over ssh and execute the startWebLogic.sh script from central operation server.
    ( ./wlst.sh restartForWLSDMUpgrade.py servers.csv )

Pre — Requirement : What is Expect Command ?

Installation with Package Manager
Redhat : yum install expect
Ubuntu : apt-get install -y expect

Installation with Source
In case you cannot load with package manager, you can download the files from the link below and then install them by applying the commands in sequence.

http://prdownloads.sourceforge.net/tcl/tcl8.5.15-src.tar.gz
https://downloads.sourceforge.net/expect/expect5.45.4.tar.gz

tar xzf tcl8.5.15-src.tar.gz
cd tcl8.5.15/unix
./configure --prefix=$HOME/local
make
make install
cd ../../tar xzf expect5.45.tar.gz
cd expect5.45
./configure --prefix=$HOME/local
make
make install

Transfering Packages to Servers with Bulk Scp Script

The name of the packages, the destination which path will be sent and which username/password informations of server should be given to a csv file as follows.

Now let’s examine in bulkScp script.

#5 : Hosts’ informations is taken from the host file which is passed as a parameter.
#10 : We use the -c parameter with expect command because of we call expect from the bash script file.
#12 : log_file will record the session to the file.
#13 : Spawn command opens a new process.
#15–16 : Expect command waits for spawned process. If output contains yes/no, we’ll send yes answer.(If the remote host key is unknown to your SSH client.)
#20 :
If output contains *pass* it, we send $_PASS information from the host file.

The step of distributing packages is finished. Next step is restarting managed and admin servers.

Restarting Managed and Admin Servers Over WLST or SSH

We will connect to domains via wlst using the domain, port, wl user and wl-pass information given in the host file. The arguments of all Managed Servers are checked. If the managed server arguments contain “wlsdm”, the server’ll restarts. Our next step is to restart AdminServer. Here we have two different scenarios. If AdminServer is targeted to a machine, restart is done with NodeManager. Otherwise, We’ll connect to the server through ssh and execute the script specified in host.csv. Let’s take a short look at our WLST script.

#12–47 : These lines contain functions for simply restarting the servers.
#49–59 : Server parameters are taken to check whether wlsdm parameter is present.
#64–81 : Here it is checked if the the AdminServer is targeted to a machine.
#95–117 :
This function restarts the Admin Server. If it is not targeted to a machine, the ssh script given in line 163 is executed.

The SSH Script is as follows. You can rearrange the scripts in this post according to your own environment and easily complete wlsdm upgrade process.

Please Watch YouTube Tutorial Video For Upgrade WLSDM:

Installation is really easy and you can setup a complete monitoring infrastructure in less than 5 minutes. If you want to try then go to download page below URL:

--

--