Configuring WebLogic Mail sessions, watches and Notifications

Can WebLogic send an email when a certain message shows up in the WLS log?  The answer is yes and it is pretty straight-forward to configure.

To setup notifications in Weblogic server (here I am taking example of OID Weblogic server), we need to create a mail session that will be used to send notification mails.

Creating Mail Sessions: 

Below is an example to create a mail session using Weblogic Console:

In above example,

aplsso_d  is the username  on Weblogic server Host  cph-sso-am01-d. Make sure you have smtp configured on the Weblogic host node

After mail session is created, it is given a target server.

It indicates on which WebLogic Server instances or clusters the mail session is accessible. Only applications that have been deployed to the selected servers or clusters can use this mail session

Configuring a Diagnostic Module:

A diagnostic system module is a software component that you configure to monitor an aspect of a server or server resource. You can configure multiple system modules to monitor different aspects of a server, but only one such module can be active on a server.

A diagnostic module contains watches and notifications. We can create watches for several monitoring aspects and can assign notifications to those watches within a diagnostic module. Notifications can be mail notifications as in this case.

Below screenshot shows the diagnostic module for wls_ods1 managed server in OID domain

We have selected target wls_ods1 managed server as target to diagnostic module created above.

 


Click on watches and notification Tab to configure watches and notifications. We have set severity as Notice, so this module will keep track of all events in this manged server under Notice tag in server level logs.

Creating Watches:

 

 

We have created a watch ServerUp which will monitor if server is Up .

Now to monitor this event, we need to set rules for this condition of server. We have edited the rules with below :

(MESSAGE LIKE ‘RUNNING’) OR (MESSAGE LIKE ‘running in Production Mode’) OR (MSGID = ‘BEA-000360’)

Similarly we will create a watch for Server condition “Down”, All step are same , we just need to change the Rule set

Rule Set for ServerDown watch is:

(MESSAGE = ‘FORCE_SHUTTING_DOWN’) OR (MESSAGE = ‘SHUTTING_DOWN’) OR (MSGID = ‘BEA-002607’) OR (MSGID = ‘BEA-000236’) OR (MESSAGE LIKE ‘SHUTTING_DOWN’) OR (MESSAGE LIKE ‘FORCE_SHUTTING_DOWN’) OR (MSGID = ‘BEA-000383’) OR (MSGID = ‘BEA-000396’) OR (MSGID = ‘BEA-000388’)

We have created watches for Server up and Server going down. Now we will create Notifications via which we will receive the notifications for defined events.

I will demonstrate the Notification for Server Up watch:

Creating Notification for serverUp Watch :

As can be seen below we are using the mail session created earlier, in this notification.

We can set our customized messages in notifications also; we can select the recipients of this notification.

Now that the notifications and watches are created, we can assign notification to respective watches.

For watch Server Up:

Similar steps are followed for Server Down notification. Save the changes and then active changes. If the configuration is fine, You will receive emails like below:

We can configure these for different log events so its convinient in troubleshooting and reducing the undesired downtimes.

 

Learn Oracle Weblogic Server Administration

 

Get 100 USD OFF + 100% Money Back Guarantee

Click here to get Early Bird Discounts

About the Author Masroof Ahmad

Leave a Comment:

3 comments
Add Your Reply