Sunday, December 21, 2014

JMS MessageBridgeRuntime monitoring

We were in the developing a orchestration application platform which requires multiple JMS Messaging bridges. We have configured near 10 Bridges to different external systems. When maanaged servers each one host a bridge it will be doubles the count that we cannot monitor on single screen in the  admin console. On the Weblogic Admin Console we can monitor the Bridge status using Bridges -> Monitoring tab.For testing we had started single managed server and checked the Bridge monitoring status.

 It could be either 'Forwarding Messages' or 'Fail to connect Source' or 'Fail to connect to Target'. The actual tragedy starts when it comes to production environment, where we have multiple managedservers in the cluster. Usually Bridges status matters when it connects to third party messaging providers such as MQ Series or something else. Assume that, there are 10 Bridges deployed to 10 managed servers on the WebLogic Console becomes very slow when you use 'Monitoring' tab to show 100 result rows from the JMX. Alternative is we must develop a Python script or something else. Searched in search engines but no luck, OTN forums have same discussions but using python there is no output or MessagingBridgeRuntime is not there on the MBean tree. This is due to bug in WebLogic 9.2 ver to WebLogic 10.3.6. It is fixed in WebLogic 12c. So previous version need to update the patch. Alternative to patch you can use weblogic.Admin utility. The following scripting trick works well to show below output.

Fetching RUNNING managed server list

The weblogic.Admin command can give you the CLUSTERSTATE which will give the all the managed servers status(such as RUNNING, SHUTDOWN, UNKNOWN, ADMIN, FAILED etc.,) in that cluster. To give more robustness to the script, extract the that running list of managed servers. So that we can get all live server bridges status. using our 'awk' seizer we can pick the managed server names which 'grep' RUNNING state.

managdserver=`java weblogic.Admin -url t3://$admURL -username weblogic -password $admpasswd  CLUSTERSTATE | grep managed |grep RUNN|awk -F'-' '{print $1}'`
Now the script

#!/bin/ksh
#================================================
# This is MessageBridge Monitoring script
# Updated by: Pavan Devarakonda
#================================================
admpasswd=Secret
admURL= hostname.company.com
domain=mydomain

echo "Starting at:"
date # For trace the time spending for this monitoring script
managdservers=`java weblogic.Admin -url t3://$admURL -username weblogic -password $admpasswd  CLUSTERSTATE | grep managed |grep RUNN|awk -F'-' '{print $1}'`

for mserver in managdservers
do
 echo "Managed Server :" $mserver
 for bridge in `grep MessagingBridge mydomain.properties| cut -d'=' -f2`
 do
  echo " "
  java weblogic.Admin -url t3://$admURL -username weblogic -password $admpasswd GET -pretty -type MessagingBridgeRuntime -mbean $domain:ServerRuntime=$mserver,Name=$bridge,Type=MessagingBridgeRuntime,Location=$mserver -property Description -property Name -property State | grep -v MBeanName
  
 done
done
echo "Bridge Status completed "
date
You must create a properties from your domain as follows:
mydomain.properties
#===================
srvr_target1=ms1_mydomain
srvr_target2=ms2_mydomain
srvr_target3=ms3_mydomain

bridge1=MQMessagingBridge1
bridge2=JMSMessagingBridge2

How to execute this script?

To execute this script you must have weblogic.jar in the CLASSPATH and java must be in the PATH that is JAVA_HOME/bin must be appended in your PATH environment variable. To execute the above Kron shell script
$ ./bridgeMonitor.ksh

To know more on Bridges and how to configure with simple python script. you can find on WLSTbyExample blog link




Technorati claim code QK7QN6U9ZST6

Monday, November 24, 2014

Who logged into WebLogic console?

Who logged into the WebLogic admin console?

Where there is multi administrators environment. It is very difficult to manage the environment. Some time management asks you to 'What the guy did on the WebLogic Admin console?' This was a nightmare for the WebLogic architect  to identify this, tracing the person who did wrong configuration. what all steps he performed.
WebLogic Admin console click on domain. Configuration->General tab Select the Advanced properites. There you can find the Audit Type.

Configuration Audit Type

By default there this is set to NONE. You have 3 options.

  • Change Log
  • Change Audit
  • Change Log and Audit


Best practices for non-production environments or production environments need to setup the Configuration Audit Type to "Change Log and Audit".

WebLogic Audit type setting

Saturday, April 5, 2014

Check system information for Capacity Planning

Working for migration projects requires lots of mesurements about the current running environment that gives you right way for predictions, estimations about the newly build environment. Thinking BIG!!! as architect for the enterprise applications, I started digging details of the system information of every machine I mean, every box and I need to prepare a table that will give all the details about the machine. This will make easy for deciding various things for WebLogic domain and its related environment.

Script Objective: Capacity Measurements

The Capacity plan is critical where a Senior WebLogic Administrator or Infrastructure Architect need to be more smarter to make wise decisions on allocated infrastructure. If you know the mesurements you can tailor your environment to give best predicated application environment platform. I had seen there is a legacy(old) shell script which gives the required information for mesurements! But it is not really robust and effective to give the desired outputs. Some of the modern CPU architectures changed and the processor information given expanded way. I thought better to renovate it in myway.  What do you say? Yes! right hmmm, I on top of it :).

The script must give outcome following factors
1. CPU Architecture
2. Num CPUs and  CPU Speed
3. Operating System Release version
4. Memory Sized (RAM)
5. Server platform
6. Virtual IP Addresses

First understood each line it was written in the script, then I refined those lines as per my thoughts and tried to get the effective output. bugging my friends if I'm not able to get desired outputs.

One Generic factor is that, I want to make this script must executed on both Solaris and also on the Redhat Linux operating environment. And finally reached the Victory!

I wish you could execute and share your experiances on HP-UX, AIX platforms as well that could help many other scripting fans.
-->

Optimizing Script: Less pipes

Recently April 2014, While teaching UNIX & Linux Scripting for WebLogic Administrators revisited this script. The scripting can be more optimized when you use less pipes (|). The usage of two commands 'cat' and 'grep' on a text file here it is /proc/cpuinfo more costly why because the number of CPU cycle consumption is the factor, that why it is changed by Swetha here. The initial script used by Swetha on Ubuntu 12 got some of the info blank and non related outputs. Infact, Linux /proc/meminfo file provides you the RAM size in kb that is little incoveniance for us. Hence changed it to MB format also in this update.

Formatted output in bash script

This time (Oct 2014) we are working on transition project and need to know about the system, Mr. Nageswaraiah Nanisetty helped me to update this script again for formatting the output in a nice format using printf and C style format definition. Tested this script in the VM, test environment as well working excellent. That is really nice to copy into excel directly by colon as delimiter.
Hope you are excited to see what is that script ? Here it is...

#!/bin/bash
clear
PATH=$PATH:/usr/ccs/bin:/usr/share/lib:/sbin:/usr/sbin:/usr/local/bin:/bin
export PATH
echo "Today's date is `date`, this is week `date +.%V.`"

format="\n%20s : %-50s"
os=`uname`
case $os in
SunOS)
 nproc=`psrinfo |wc -l` ;
 prspeed=` psrinfo -v | grep -i Hz |awk '{print $6" " $7}'|uniq  `
 inet_addrs=`ifconfig -a |grep -i inet | awk '{print $2}' `
 mem=`prtconf |grep -i size`
 ;;
Linux)
 nproc=` grep -i processor /proc/cpuinfo |wc -l`
 prspeed=` grep -i model /proc/cpuinfo |grep -i hz |awk '{print $9 }'|uniq `
 inet_addrs=`ifconfig -a |grep -i inet | awk '{print $2}' |cut -d ":" -f 2`
mem=` grep -i MemTotal /proc/meminfo | awk '{print $2}' `
mem="$(($mem/1024))MB"
    VENDOR=`cat /proc/cpuinfo | grep 'vendor_id' | cut -d: -f2 | awk 'NR==1'`
    MODEL=`cat /proc/cpuinfo | grep 'model name' | cut -d: -f2 | awk 'NR==1'|sed 's/ //g'`
    MHZ=`more /proc/cpuinfo | grep 'cpu MHz' | cut -d: -f2 | awk 'NR==1'`
   FLAVOR=`lsb_release -i |awk '{print $3}'`


esac
hname=`hostname`
arch=`arch`
uname=`uname -r`
printf "$format"  "Processor Arch" $arch
printf "$format"  "Host name" $hname
printf "$format"  "Operating system" $os
printf "$format"  "Release" $uname
printf "$format"  "Number of CPU" $nproc
printf "$format"  "CPU speed" $prspeed
printf "$format"  "RAM Size" $mem
printf "$format" "CPU Model" $MODEL
printf "$format" "Vendor" $VENDOR
printf "$format" "Flavor" $FLAVOR


echo
for IPAddr in $inet_addrs
do
 if [ $IPAddr != "127.0.0.1" ]
 then
  if [ $os = "Linux" ]
  then
   IPAddr_name=`nslookup $IPAddr|grep -i name |awk '{print $4}'`
  else
   IPAddr_name=`nslookup $IPAddr|grep -i name |awk '{print $4}'`
  fi
  if [ ! -z ${IPAddr_name} ]; then
        printf "$format" "IPaddress-DNS"  $IPAddr-$IPAddr_name
  fi

 fi
done





Execution of the script gives output as follows:
$ ./sysInfo
Today's date is Fri Oct  3 21:26:09 SAST 2014, this is week .40.

      Processor Arch : x86_64
           Host name : myrhel.vybhava.edu
    Operating system : Linux
             Release : 2.6.18-274.el5
       Number of CPU : 24
           CPU speed : 2.67GHz
            RAM Size : 54358MB
           CPU Model : Intel(R)Xeon(R)CPUX5650@2.67GHz
              Vendor : GenuineIntel
              Flavor : RedHatEnterpriseServer

       IPaddress-DNS : 192.168.1.105-myrhel.vybhava.edu


After preparing my statistical table, reviewed and got an idea for include the disk space avaialble on every machine. That is the great result of good reviewer (my buddy did it!). So I need a disk size that I can get by df command but -lk is going to give in kilobytes, option -h works on Linux, Solaris 10 but summing up is issue so I took kilobytes and did convertions as follows:
df -lk | egrep -v "Filesystem|/proc|/dev/fd|swap|/home|/platform" | awk '
 { t += $2 }
 { u += $3}
 {GB2 = 1024*1024} END 
 { printf "%d of %d Gb in use.\n", u/GB2, t/GB2 }'
This command line excludes header, /proc, floppy, swap, user space and sun packages in /platform for Veritas.

35 of 130 Gb in use
Cheers! enjoy have fun in your work!

Good Reference:

http://www.brandonhutchinson.com/Gathering_Solaris_system_statistics.html

Keep writing your innovative ideas, generic suggestions in comments!!

Monday, March 24, 2014

Thread Dump Analysis


Dear WebLogic users/Administrator you might already visited many other sites that discussed about - how to take the thread dump. But here I am going to tell you about automation script makes more simplified way of working, with more information - almost 70% on the occasion of STUCK thread Thread dumps will reveals. In case of High CPU utilization situations, which method is badly working.

Step by Step analysis for Thread Dump


Step 1: Automated Thread Dump for WebLogic

Take the Thread dump for a managed server that have issues or slowness or latency etc. You just read the description and start applying to your test environment and then try out on your Live environments. Cheers!
#!/bin/bash

# This script will takes the managed server name as argument and it will work generic to Linux or SunOS or HP-UX.
# The only ps command options varies for each platform
# Kill -3 command used for every 10 seconds of interval. You can increase the number of dumps in the for loop

WL_SERVER=$1
OSENV=`uname`

   case $OSENV in
      Linux)WLSPID=`ps auxww|grep weblogic|grep -v grep|grep $WL_SERVER | awk '{print $2}'`;;
      SunOS)WLSPID=`/usr/ucb/ps -auxww|grep weblogi[c]|grep $WL_SERVER | awk '{print $2}'`;;
      HP-UX)WLSPID=`ps -efx|grep -v grep|grep weblogic|grep $WL_SERVER | awk '{print $2}'`;;
   esac
   if [ ! -z "$WLSPID" ]; then
      for i in 1 2 3 4 5
      do
         echo "Generating thread dump number $i in logs/${WL_SERVER}_stdout.log"
         jstack  $WLSPID >> /log/${WL_SERVER}_stdout.log
         sleep 10
      done
   else
      echo "Error!!! process id not found for $WL_SERVER"
   fi

Step 2: Start analizing Thread dump

Take the sed sword into your hands !! sed UNIX utility will give you the right way of using regular expressions to expose desired outputs. The following is more effective script for you, love it share it :)
# Script Name: ThreadAnalizer.sh
# Description: Pass the threa dump log file name as argument to this script it will show you the required lines that need to see 
# Regular expression pattern is applied for search in the log file.
clear

for i in `egrep 'trying to get lock|waiting to lock' $1 |  sed -n 's/.*[<@]\(.*\)[>[].*/\1/p' | sort | uniq`
do
 # Under that above line you will look thru the log for locked or holding lock
    sed -e '/./{H;$!d;}' -ne 'x;/ locked/{;/'${i}'/p;};/Holding lock/{;/'${i}'/p;}' $1
done
Look for more deeper with the handy utility that uses python. The following script can work to convert the given decimal number to hexadecimal number.
USAGE="Usage: $0 {number}"
if [ ! $# == 1 ]; then
  echo $USAGE
  exit
fi
 
python -c "print hex($1)"
exit 0

The following script can work to convert the given decimal number to hexadecimal number.

If you want to generate a separate thread dump file with prstat, pstack commands output it will be much wise. Everything in single file to analysis at the time of critical situations. Ofcourse it happen only in UNIX environments :).

WebLogic Application performance problems: Diagnosing

The following presentation will take you to understand with a clarity on OOME types and what are all the reasons. It also address the High CPU issues.
Write a comment what do you thing on this issues. Happy trouble shooting!!!

RegEx for WebLogic Admin

Trick on grep


Normally every WebLogic user/Admin knows that "ps -ef|grep java" gives you the WebLogic servers process list in any UNIX or Linux environments. Most of the forums suggesting use "|grep -v" to exclude the "grep line". But, here I don't want to use one more pipe and grep -v option really makes expensive in CPU cycles. Searched for the optimistic solutions and finally found! Two choices using --exclude  and using regex.

The exclude options is not available on all UNIX systems. So I've chosen next option.

How do you avoid the grep line in the grep command output itself?
Here the trick is using the regular expression to workout this requirement. Use your searching pattern any one of the character in [] then it will automatically excludes the grep line from the output. actually it wouldn't get output itself!

bash-2.05$ ps -ef |grep jav[a]
weblogic   950   934  0   Feb 10 ?        0:06 /usr/local/bea/jdk142_11/bin/java -client -Xms32m -Xmx200m -Xverify
:none

Note here I have tried out this trick on Sun Solaris 9 machine. Write your experiments in the comment box, share it!

Sunday, March 16, 2014

WebLogic Server name its PID, CPU, MEM

I am on a 'THINKING CHAIR' again, thinking to find the fine chopped shell script for displaying process id on the opposite to it the WebLogic(java process) instance name. This is the regular need for any WebLogic Administrator.

1. Some times the Thread counts monitoring cannot help to know the status of the Server instance then need to look for the instance is alive or not. That is the java process exist for that particular instance.
2. You may get Stuck Thread alert for any machine through your monitoring tools (HP OVO, Introscope or some other). Then you need to get the thread dump for the stuck thread found WebLogic instance.
3. You may want to kill an instance for any abnormal reasons

What is 'ps' command does?

The 'ps' command gives us information about processes status on Solaris or Linux or any other UNIX flavor.  There are different varieties of 'ps' command paths
i) /usr/bin/ps
ii) /usr/ucb/ps

If you type “ps” at the prompt, and you get very little information about the process.

ps command switches

The ps command switches are key, as always required to get the desired output of ps command. To get a complete list, for instance, type switches with prefix - symbol.

  • “ps -A” (Note: Linux is case-sensitive). Also, 
  • “ps -e” will give you a complete list of processes running on the machine. 
  • "ps -f" give a full listing, i.e. more information about each process listed 
  • "ps -u username" will list all processes running by a specific user mentioned as argument value
  • "ps  -l" gives a long listing of processes. This is even long data than in a full listing

The power to this 'ps' command will be filled up with its options, If you know how to use the options you can make wonders!! Now I need to know what are those options which could help me to write the script. You tell me what to do? Well your answer is go to our super duper search engine 'Google'.  ps(1B) man page on Oracle sun site. I selected -a, -ww, -x options that could help me to get complete command details of a process id associated with it.

Now I need to use 'cut' command for the WebLogic instance name from the big process detailed text. This is really challenge dear, what you suggest dear super reader? After running between many sites and man pages I got to know few ideas on awk and its family nawk command script.

This script is a generic script I had executed for WebLogic 9.2, 11g also. You can apply this for WebLgoic 7/8.1 also.




# FileName: wlsPid.sh 
# This script will Fetches PID of WebLogic Server instances 
# =========================================================
clear
echo "PID associated with WebLogic instances"
echo  "====================================="
/usr/ucb/ps -awwx | grep "weblogic.Name" | grep -v "grep weblogic.Name" | nawk 'BEGIN {print "PID\tWLServer";
print  "=====================================" } ;
        {
        NUM = match($0, "weblogic.Name=") ;
        START_POS  = RSTART+RLENGTH ;
        START_STR = substr($0, START_POS) ;
        FINISH = match(START_STR, " ") ;
        FINISH_POS = START_POS+RSTART+RLENGTH ;
        FINISH_STR = substr($0, START_POS, FINISH_POS) ;
        NUM = split(FINISH_STR,FINISH_ARRAY) ;
        printf ("%s\t%s\n",$1, FINISH_ARRAY[1]) ;
        }
        END {
        print "===================================="}'

#=== Published on http://wlatricksntips.blogspot.com  ===== 

The above script is executed on Solaris 9, 10 the output will look like as follows:
PID associated with WebLogic instances
=====================================
PID     WLServer
=====================================
1354    admin
11469   mserver01
11581   mserver02

 

Similar type of script is required for Linux machines too. Then I need to change the above script in 3 places.

The ps command options, Linux supports gawk (GNU awk) instead of nawk. The final thing to change is the string that requires not to grep useless string.


Perl for WebLogic on Linux
With the ps command we can get the desired output onto standard output. Perl having great Match, split built-in functions. In Linkedin Perl group, I followed Ashutosh Kukreti tips. You must be member so that you can see the discussion. I had posted the question about my requirement. After looking into Perl regular expressions usage.

#!/usr/bin/perl
 
$plist = `ps -U \$LOGNAME -o pid,pcpu,size,cmd|grep -i weblogic.Name|egrep -v grep`;
$CPU_THRESHOLD=10;
@prlist = split(/\n/ ,$plist );
print "PID    SERVER          CPU     SIZE      DOMAIN DIR
------ --------------- ------ ------  -----------------------------------
";
 
$i=0;
foreach $_ (@prlist){
        $x=$prlist[$i];
        $x=~ m/^\s*(\d+)\s.+\s+-Dweblogic\.Name=(\S+)\s+/ ||next;
        my @values = split(' ',$x);
        $pid=$1;
        $server=$2;
        $cpu=$values[1];
        if($cpu > $CPU_THRESHOLD)
        {
                print "\n\nSUGGESTED ACTION:\n"
                        . "-----------------\n"
                        . "Use this command to trace threads on servers "
                        . "with over $CPU_THRESHOLD% CPU usage:\n"
                        . "/usr/bin/kill -3 " . $pid."\n";
        }
        $mem=int($values[2]/1024);
        $r = `/usr/bin/pwdx $pid 2>&1`;
        $r =~ s/^\d+://;
        $r =~ s/^\s+|\s$//g;
        print $pid, "\t", $server,"\t",$cpu,"\t",$mem,"M\t",$r,"\n";
        $i++;
}

This part of Perl script, my friend SRIKANTH PANDA helped me to get process id and its related info with ps command.

weblogic automation - process details, memory details with utility script
WebLogic PID, CPU Load, MEM Automation script - Perl Script

Here in this script you can set your application desired CPU_THRESHOLD value to get notifying mails. After saving the file provide the execution permissions with chmod u+X wlsps.pl. The following is the output which I've executed on Ubuntu Linux with WebLogic 12c.

$ ./wlsps.pl
PID    SERVER          CPU     SIZE      DOMAIN DIR
------ --------------- ------ ------  -----------------------------------
2518 AdminServer 2.8 860M /home/pavanwla/wlsdomains/medrec

Enjoy the fun with scripting tricks on your latest WebLogic environments, keep posting your updates and thoughts on this blog. Share this blog in your technical blogs.

Wednesday, January 1, 2014

Setting up a best login profile on UNIX


Usually when you are working on building the platform for any application, you might be given UNIX (Solaris/Linux/HP-UX/AIX) boxes and new generation with Virtual boxes. which contains nothing you need to do many installations and configurations. To make your administrative task easy and simple we need to setup a fine tuned profile file. This profile file will be holding the multiple environment variables those are reusable when you log-on to UNIX Kernel  Here you can define shell functions or you can define simple single lined aliases that makes lengthy commands set to simple trimmed single letter or meaningful words.

What is user SHELL and  its profile association?


In your UNIX Kernel when a new user login will check the /etc/passwd file which shell is assigned by the super-user. It will look for the system profile and assign the environment values, then on top of it user profile can be loaded. Hence the variable is defined in system profile can be overridden by user profile. Example PATH environment variable that can be over written by user defined profiles most usual thing it is. So careful while defining such variables. It could behave differently for Solaris same line cannot work on Linux or on AIX box.

Why do we need this to be customize User profile?


Any Middleware admin may involve install and configuring the Apache or Oracle WebCenter Sites or spaces or SOA, Hadoop or Build and deployment platform may requires ANT or Gradle, Jenkins or Hudson setups. Every component that interacts with Middleware runs on the same UNIX Kernel need customized variables that can be referred from any directory or path, so we need them as global variables, this you can acquire by defining them as environment variables in SHELL profile. UNIX Operating system provides all shells associated with a  specific default system provided and a user profile script and that is in the hidden file which prefixed with dot(.) so it looks like .profile in your home directory. You can view them by ls -la command.

Where can I find this profile script?


Usually when you login to UNIX Kernel, you will be landing to a directory that is designated to your user HOME directory. Suppose you already working on some other path, you can simply use cd  or cd ~ and press enter the OS will takes to home directory. Alternatively you can use system defined environment variable by giving cd $HOME.



How do I know I am in which SHELL?


First you need to know about your user login SHELL(default). Every user can have different choice of having a shell. Once you have assigned user or role for WebLogic environment setup then  how do you know what SHELL it is? use the following:

$echo $SHELL
/bin/sh

How many SHELL do my env have?
To know this you could do little experiment on your prompt with the following commands

$ type bash
/usr/bin/bash


Then you can look in that directory all shell names ends with 'sh', list them with small regular expression trick on your ls command. The main trick here is using 'anchor' symbols, the $ symbol indicates ending of the word pattern, and you can use for avoiding the .sh files in that directory character classes can be negated with the [^] syntax.
[WLA@server~]$ cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh
...

[WLA@server~]$ ls /usr/bin | grep [^.]sh$
bash
csh
hash
jsh
ksh
pbksh
pbsh
pfcsh
pfksh
pfsh
remsh
rksh
rsh
ssh
tcsh
zsh
[WLA@server~]$ ls /usr/bin |grep [^.]sh$ |wc -l
cat /etc/shells

How to set bash as login SHELL?

I feel the Bourne Again Shell (bash) is best suitable login shell for WebLogic environment setup.
Sample .bashrc script which will be executed automatically when you hit 'bash' command at your Linux command prompt.
export JAVA_HOME=/u01/app/oracle/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:$PATH
export MW_HOME=/u01/app/oracle/fmw122120
export WL_HOME=$MW_HOME/wlserver
alias wlst="$MW_HOME/oracle_common/common/bin/wlst.sh"

echo ===================================

Now your immediate question might be 'How do you know which shell is assigned to your user profile?' Here is the Trick for you!!

$ echo $SHELL
/bin/sh

The login shell will be assigned as per the common profile set by Solaris/Linux Administrator. That can be changed by passwd -e or passwd -r if you must have root access then only you can do editing the passwd file and update your desired shell there. Some times it is rejects you and shouts 'permission denied'. Just smile on it you can proceed with the following trick!! Using exec command, that will replaces the existing shell with new shell that you want.

export SHELL=/usr/bin/bash
exec $SHELL -l

Shell replacement ksh to bash with exec

What is a process?

process is an entity in execution. The process can be created by fork, exec system calls. the exec system call replaces current process. In the above also happens same for login shell. Example  If your default login shell is given as KSH(/bin/ksh), but in your .profile given exec command to replaces the shell with BASH(/bin/bash).


So, now I am ready with sample .bash_profile for WebLogic 11g for Solaris 10

Implementing the best practices all together, to make this most generic profile. 

#==============================================
# Sample .bash_profile or .bashrc or .profile for ksh
# Middleware Admin  on Solaris 10 operating environment
# Updated : October 8, 2010
#==============================================
clear

USERNAME=$LOGNAME
HOSTNAME=`hostname`
#---------- echo Welcome message ---------------------
echo
echo Welcome $USERNAME. You are on Server: $HOSTNAME !!!
export JAVA_HOME=$HOME/Oracle/Middleware/jdk160_18
#---------------WebLogic Specific ---------------------------------------
export MW_HOME=$HOME/Oracle/Middleware/
export WL_HOME=$MW_HOME/wlserver_10.3

export ORACLE_HOME=/opt/oracle/product/9.2.0
export LD_LIBRARY_PATH=$WL_HOME/server/native/solaris/sparc:$WL_HOME/server/lib/solaris/oci920_8:$ORACLE_HOME/lib32:$LD_LIBRARY_PATH
 
export THREADS_FLAG=native
export PATH=$PATH:.:$JAVA_HOME/bin:/usr/bin:/usr/ucb:/etc:$WL_HOME/bin:$ORACLE_HOME/bin:/usr/ccs/bin:/usr/share/lib:/sbin:/usr/sbin:/usr/local/bin:$WL_HOME/server/bin

export CLASSPATH=$WL_HOME/server/lib/weblogic.jar:$JAVA_HOME/jre/lib/rt.jar
#---------------- End of WebLogic specific ---------------------------------
export MANPATH=$MANPATH:/usr/share/man
export EDITOR=vi
export PS1="[\u@\h \w]\$ "
 
alias cls="clear"
alias sl=ls
alias cd..="cd .."
alias cd...="cd ../.."
alias gi="grep -i"
alias l="ls -al|grep '^d'"
alias lm="ls -al | more"
alias h=history
alias hm="history | more"
alias nu="who|wc -l"                # nu - number of users
alias np="ps -ef|wc -l"             # np - number of processes running
alias p="ps -ef"
alias help=man
alias path="echo $PATH"
##### End of the sample .bash_profile for smart WLA #################
#===== Published on http://wlatricksntips.blogspot.com =============#

Importance of DOT(.) in PATH
I just started using the above .bash_profile but, something missing in it... when I wish to start my WebLogic server from domain home I need to give dot and forward slash (./). This looks somewhat unusual, when I add a DOT( .) in PATH variable made everything normal and I can start my WebLogic instances with my customized script from the prompt.

Power of PATH
More power to your user shell with adding /usr/sbin most of the network, system relavent commands available to you at command prompt.

The changes I made for the PATH line adding JAVA_HOME/bin your latest Java binaries will be useful at command prompt such as jps, jstat, jmap very useful when you deal with heap dumps and memory issues, $WL_HOME/server/bin consists of most of the WebLogic related configuration and maintenance commands available to you, it is little trick you need adding this in Solaris and Linux because it uses L-R precedence on Solaris for Linux R-L use appropriately.

export PATH=$PATH:.:$JAVA_HOME/bin:/usr/bin:/usr/ucb:/etc:$WL_HOME/bin:$ORACLE_HOME/bin:/usr/ccs/bin:/usr/share/lib:/sbin:/usr/sbin:/usr/local/bin:$WL_HOME/server/bin

Java want CLASSPATH
When there is a need of running ANT or build scripts you need runtime that is rt.jar and tools.jar in CLASSPATH this very often.

If you are using JRockit instead of SunJava then you don't need the rt.jar or tools.jar files in CLASSPATH. Other than this we have WebLogic specific utility commands that can be run from any where if you add weblogic.jar into the CLASSPATH. You can run the following command line utilities:

  1. java weblogic.WLST
  2. java weblogic.Admin
  3. java weblogic.Deployer



Overcome Human Errors with Alias
Mistakes can be made by humans it is obvious thing. Mostly while working on UNIX environments while typing the command there could be mistype happens. Example very effective WebLogic troubleshooter in the pressure situations might mistype 'sl -l' instead of 'ls -l'. sometimes 'l s-lrt' these mistakes can be over come with proper identifying our typing styles :) define them as alias with correct command.

That looks pretty and easy to use. If you need any assistance write a comment or reach me on G+ or FB please don't shy!!  : )

Usage of umask

When your WebLogic server generating logs need common access to the other users who are just monitoring the system or auditing the system. Such users are not WebLogic admin user, even though they need to access your logs. For this privileges every WebLogic server logs folder you need to update using chmod command repeatedly. To resolve this best option is using umask.

Don't forget to write back your comments and queries.

Ubuntu profile setup in VM

Now a days Ubuntu became almost alternative for Windows OS with great UI features in a Linux flavors. In Ubuntu the default user shell is 'bash'. The order it will execute according to the system profile. The system contains bashrc. So you can place your environment variables int the .bashrc or else alternatively you can call the . ~/.bash_profile in the .bashrc
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export PATH=$PATH:$JAVA_HOME/bin
export WL_HOME=/home/pavanwla/Oracle/Middleware/Oracle_Home/wlserver
export CLASSPATH=$WL_HOME/server/lib/weblogic.jar:.

Please share your experiance with profile and without knowing about the profile. Lets have best profile for your WebLogic environments that you build. References
1. http://www.unixguide.net/unix/bash/A7.shtml
2. http://djcraven5.blogspot.com/2008/03/change-solaris-shell-to-bash.html
3. http://www.cyberciti.biz/faq/solaris-unix-change-default-shell/
4. http://www.ibm.com/developerworks/aix/library/au-speakingunix_commandline/?S_CMP=cn-a-aix&S_TACT=105AGX52
5. The umask command usage

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me wlatechtrainer@gmail.com
QK7QN6U9ZST6