Saturday, July 24, 2010

Setting Up An Email Alert System To Monitor Server Status Using Diagnostics Module In WebLogic Application Server

We need our application deployed in WebLogic Server to be up all the time, we cannot take risk the application downtime, and we cannot risk our business, but to monitor the servers which hold live applications need monitoring for the application availability.

WebLogic Server allows the usage of external tools and utilities for monitoring of internal application and components by executing various types of operation on MBeans like set() and get(), there are many more tools, utilities are in the market to provide monitoring feature for WebLogic Server and its deployed applications
Here in this post we are going to work/discuss on a Unique feature of WebLogic Server Called WebLogic Diagnostics Framework, In that we are going to work on Diagnostics Modules, with this we can monitor JMX Beans and system statistics.

For Testing purpose we are carrying out the experiment Production Mode Enabled - ProdDomain

(Please Note : Right click and Open In New Window on the images to enlarge it)
Setup A Java Mail Session

Step 1. Create A Mail Session


Step 2. Specify the connection parameters for Java Mail
Step 3. Target it to Admin Server or Server you wanted to Monitor


Step 4. Verify Mail Session Information
Configuring Diagnostics Modules , Notifications and Watches

Diagnostics Modules
Step 5. In Left Hand Side Navigation Tree Select Diagnostic Modules to Add New Diagnostic Module Monitor WebLogic Server
Step 6. Enter Basic Information to Create WebLogic Server Diagnostic Module

Create Notifications and Watches
Step 7. Select Watches and Notification Tab and Select Severity and Log Watch Severity to Notice

Step 8. Scroll down on the same page to add new Watches and Notifications
Step 9. Create new Notification as shown above

Step 9. Set Up Email Preferences for the Notification and Finish the Configuration
Step 10. Create the Watch From Where you have created Notifications.
Step 11. Provide Watch Name and Watch Type as above and Keep Enable Watch Checked
Step 12. Configure What to Watch For the Server After Clicking on Adding Expression
Step 13. You Can Many Number of Watches to the Watch Database you Can see MSGID Updated in above Picture
Please Note : Here We Are setting up the watch and notification for RUNNING Status for the server as BEA-000360 is BEA Message Code for  Server RUNNING Status

Step 14. Do Not Set Any Alarms
Step 15. Assign the Notification Created for the Status of The WebLogic Server to the Watch Just Created
Step 16. Activate All the Pending Changes

Setup Mail Server For Receiving Mails From WebLogic

Download Apache Mail Server (JAMES) from this link or go to Download Page for latest releases

Unzip the downloaded zip file and follow the following steps

Step 1. Go to C:\James\james-2.3.2\bin directory


Step 2. Edit run.bat file if you are running it in Windows (For Unix you have run.sh file)


Step 3. Add line "set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_13" ( Your JAVA_HOME Directory)


Step 4. Open Command Prompt ( Start -> Run -> CMD -> Enter)


Step 5. Navigate to Path -> C:\James\james-2.3.2\bin


Step 6. Execute run.sh file from this path


You will see following O/P

C:\James\james-2.3.2\bin>run.bat
Using PHOENIX_HOME:   C:\James\james-2.3.2
Using PHOENIX_TMPDIR: C:\James\james-2.3.2\temp
Using JAVA_HOME:      C:\Program Files\Java\jdk1.6.0_13

Phoenix 4.2

James Mail Server 2.3.2
Remote Manager Service started plain:4555
POP3 Service started plain:110
SMTP Service started plain:25
NNTP Service started plain:119
FetchMail Disabled


Your Mail Server is Up Now, The Service is running at 4555 port number on localhost.


Step 7. Telnet to localhost with Port Number 4555


# Default User Name and Password for Mail Server is root/root

Step 8 . Create "WebLogic" User
JAMES Remote Administration Tool 2.3.2
Please enter your login and password
Login id:
root
Password:
root
Welcome root. HELP for a list of commands
HELP
Currently implemented commands:
help                                    display this help
listusers                               display existing accounts
countusers                              display the number of existing accounts
adduser [username] [password]           add a new user
verify [username]                       verify if specified user exist
deluser [username]                      delete existing user
setpassword [username] [password]       sets a user's password
setalias [user] [alias]                 locally forwards all email for 'user' to 'alias'
showalias [username]                    shows a user's current email alias
unsetalias [user]                       unsets an alias for 'user'
setforwarding [username] [emailaddress] forwards a user's email to another email address
showforwarding [username]               shows a user's current email forwarding
unsetforwarding [username]              removes a forward
user [repositoryname]                   change to another user repository
shutdown                                kills the current JVM (convenient when James is run as a daemon)
quit                                    close connection

adduser weblogic weblogic   (weblogic/weblogic - UserName/Password)
listusers
weblogic

Step 9. Set Up A Mail Client ( Can be Mozilla Thunderbird)


Download Mozilla Thunderbird From this link Or Select from latest releases here


Install Mozilla Thunderbird and Configure the POP3 Settings for weblogic user just we've created


Step 9. Time to Test the experiment - Stop the Admin Server in ProdDomain


Step 10. While Starting The WebLogic Admin Server you will see in the below log in console.



tusWatch' with severity 'Notice' on server 'AdminServer' has triggered at Jul 24
, 2010 8:40:07 PM IST. Notification details:
WatchRuleType: Log
WatchRule: (MSGID = 'BEA-000360')
WatchData: DATE = Jul 24, 2010 8:40:07 PM IST SERVER = AdminServer MESSAGE = Ser
ver started in RUNNING mode SUBSYSTEM = WebLogicServer USERID = SEV
ERITY = Notice THREAD = Main Thread MSGID = BEA-000360 MACHINE = shdyade TXID =
 CONTEXTID =  TIMESTAMP = 1279984207391
WatchAlarmType: None
WatchAlarmResetPeriod: 60000
>

Step 11. Check The Mail


 

This is it...  :)












Please let me know if any questions/suggestions, mail me for feedback on this





3 comments:

Sushil Kumar Rai said...

good one !!

Rgs

Sushil

Shailesh Dyade said...

Thanks Sushil

~Shailesh

Unknown said...

In mailsession after giving target and finish getting java exception.