Tuesday, December 7, 2010

Get the server "STATUS" when server is offline..!! -- PART - I

Hello All,

While I was away for some of the photography and some techno-graphy, I did some of the nice moves on the Photography side and Technology side..

You can catch my photography on my http://magical-shots.blogspot.com and here for Technology I work on..!!

These days I was working some of the SNMP features, many of you may know that we need SNMP to monitor the WebLogic Servers in various aspects as to monitor the WebLogic Server MBeans

Here we setup SNMP Traps for UNKNOWN Status of the server.

This scope is divided into 2 scopes of SNMP Functions
1. Domain Scoped SNMP Agent
2. Server Scoped SNMP Agent

In this Part we will work on Domain Scoped SNMP Agent.

In WebLogic Server Version 8.1 This feature of UNKNOWN Server Traps Generation was possible, but when new portal versions (9.2, 10.x and 11g) are introduced this feature faded to appear, and in new versions server doesn't generate any traps for UNKNOWN status of the server.

We believe that, whenever server enters into UNKNOWN Status, it will not be able to send any messages to Admin Server about its status as the status of the server will not be known to the Admin Server, and after all Kill -9 and a abrupt power failure of the server or many other circumstances result into pushing server into UNKNOWN Status.

For this feature, we have to apply the patch developed by Oracle (Patch ID : UE4C)

And then follow the following Steps to Setup a SNMP Traps for UNKNOWN Status of the Server.

I am using WebLogic Server Version 10.3.0.0

Step 1. Go to Servers, Check the status as Shutdown after starting the Admin Server





Step 2. Click on Diagnostics --> SNMP









Step 3. You can see a pre-existing domain scoped SNMP Agent in disabled state. Click on that and Enable the SNMP Agent by Click on the Check Box.



















Step 4. Save the Configuration.
























Step 5 . Configure the String Monitors.

Please Note : Don't Target any of the Servers.
















Step 6. Save the configuration.

Step 7. Create Trap Destination as in below Configurations.






















 Step 8. Save and Activate the Changes.

Step 9. Start the SNMP Trap Monitor as in below command after setting the WebLogic Environment.

"${JAVA_HOME}/bin/java" weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 1121
Step 10. Now try to start one of the Managed Servers and watch the traps from the server.

Here are SNMP traps for various states for WebLogic Servers you will see..

For Successful Server startup :

--- Snmp Trap Received ---
    Version        : v1
    Source         : UdpEntity:10.177.57.149:1101
    Community      : public
    Enterprise     : enterprises.140.625
    TrapOID        : enterprises.140.625.0.65
    RawTrapOID     : 1.3.6.1.4.1.140.625.0.65
    Trap Objects   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:20:00 GMT+05:30 2010 }
   { enterprises.140.625.100.10=Managed-1 }
}
    Raw VarBinds   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:20:00 GMT+05:30 2010 }
   { enterprises.140.625.100.10=Managed-1 }
}

For Successfull Server Shutdown :
--- Snmp Trap Received ---
    Version        : v1
    Source         : UdpEntity:10.177.57.149:1101
    Community      : public
    Enterprise     : enterprises.140.625
    TrapOID        : enterprises.140.625.0.70
    RawTrapOID     : 1.3.6.1.4.1.140.625.0.70
    Trap Objects   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:18:33 GMT+05:30 2010 }
   { enterprises.140.625.100.10=Managed-1 }
}
    Raw VarBinds   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:18:33 GMT+05:30 2010 }
   { enterprises.140.625.100.10=Managed-1 }
}
For Server Kill or Power Failure kind of instances..!! - Implemeneted Kill -30 on the WebLogic Java process as it assumes to be power failure.

--- Snmp Trap Received ---
    Version        : v1
    Source         : UdpEntity:10.177.57.149:1101
    Community      : public
    Enterprise     : enterprises.140.625
    TrapOID        : enterprises.140.625.0.75
    RawTrapOID     : 1.3.6.1.4.1.140.625.0.75
    Trap Objects   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:22:40 GMT+05:30 2010 }
   { enterprises.140.625.100.10=AdminServer }
   { enterprises.140.625.100.55=jmx.monitor.string.matches }
   { enterprises.140.625.100.60=UNKNOWN }
   { enterprises.140.625.100.65=UNKNOWN }
   { enterprises.140.625.100.70=com.bea:Name=Managed-1,Type=ServerLifeCycleRuntime }
   { enterprises.140.625.100.75=ServerLifeCycleRuntime }
   { enterprises.140.625.100.80=State }
}
    Raw VarBinds   : {
   { enterprises.140.625.100.5=Tue Dec 07 20:22:40 GMT+05:30 2010 }
   { enterprises.140.625.100.10=AdminServer }
   { enterprises.140.625.100.55=jmx.monitor.string.matches }
   { enterprises.140.625.100.60=UNKNOWN }
   { enterprises.140.625.100.65=UNKNOWN }
   { enterprises.140.625.100.70=com.bea:Name=Managed-1,Type=ServerLifeCycleRuntime }
   { enterprises.140.625.100.75=ServerLifeCycleRuntime }
   { enterprises.140.625.100.80=State }
}

Please let me know if you are facing any difficulty in setting SNMP.

Thanks,

Your comments are much helpful.

Shailesh Dyade





Thursday, October 21, 2010

WLST Simplified..!!

Hello All,

After a long gap I am posting in this blog again, as I was stuck with my Photography interests and the result is my new blog : http://magical-shots.blogspot.com, please visit once and share some views if you really like it..!!

In last few days I was busy with a nice tool/application which is developed by Collabnet for use with WebLogic Server various versions called WLNav (WebLogic Navigator), its very nice tool if you really want to get rid of WLST's Black Screen and Commands, You can find this tool @ http://wlnav.open.collab.net/

Its basically built on WLST and accesses all MBean Information of WebLogic server, so give it a try, download it from the above link and Deploy it on desired server and access the application providing username and password for WebLogic server for the application interface, and then you will see how good the application is designed..

Please Note : You Should know basics of WLST to actually understand this, if you need any understanding about WLST, please let me know, I will be really happy to post WLST Topics on demand.!!


Sample Picture of this Application :














Please share comments if you like..!!

Thanks
Shailesh Dyade

Thursday, September 2, 2010

Script to find the PID of the Process which ps command cannot list.

Sometime we may need some command or code or logic to find the process id of the process when every other command fails to do that, like if you use ps -ef | grep then you will fail to see the process, but the same time if the process was using some port for example 8888, then after killing the process by kill -9 or shutting down the process by using specific shutdown scripts, the port will be still active at that time you will fail to bind this port with new process of same server/instance.

for that we can use following shell script to find out the socket process which are still active on the ports, it will list by process id.

#!/bin/bash



# is the port we are looking for

if [ $# -lt 1 ]
then


echo "Please provide a port number parameter for this script"


echo "e.g. %content 8888?"
exit


fi

echo "Greping for your port, please be patient (CTRL+C breaks) . "

for i in `ls /proc`
do


pfiles $i
grep AF_INET
grep $1


if [ $? -eq 0 ]


then


echo Is owned by pid $i


echo ""


fi

done

Any comments ?? / Suggestions ??
 
Thanks
Shailesh

$ Symbol in UNIX - Dollar Symbol in Unix

Many of us still wonder about what $ symbol stands for, some of us know that $ stands for shell prompt for user and # stands for shell prompt for root in many Unix systems, but we have different meanings for different types of symbols associated with $ as below.

$ Symbol is used in UNIX as variable in sometimes and sometimes its used to define some variables.

In first case we have many variables associated with $ as below.

$? = Stores last commands exit Status
$$ = Stores PID of the current process.
S# = Stores number of passed parameters
$*/$@ = Lists all the passed parameters
$0 = Stores the Program or Script name
$1 - $9 = Stores the first 9 Parameters passed to the script.

For Second case :

We have some variables set for environment like

$PATH
$SHELL
$USER ... etc.


and we can define the values using $  Symbol once

bash-3.00$ x=1

bash-3.00$ echo $x
1
bash-3.00$

Thanks
Shailesh Dyade

Tuesday, July 27, 2010

Link for LDAP

Hello All,

I have found this link, which provides most comprehensive books and documentation for LDAP.

Please go through this if you need any information on LDAP.

Thanks
Shailesh Dyade