Many a times we would like to alert when there is a gradual decrease in the heap memory or a managed server shuts down abruptly,so the question is can weblogic send a email when a certain message shows up in the WLS logs.

The answer is yes and its preetty easy and staright forward to configure.Follow the below steps to create a straightforward watch and notification .

=========================================================
Steps to create the EmailAlertMailSession mail session:
=========================================================

Access the Admin console on your webbrowser.
-----------------------------------------------

Take lock and Edit session.

Click on Mail Sessions.

Click on New button and type EmailAlertMailSession in the Name field.

Type mail/emailAlertMailSession in the JNDI Name field.

Add the JavaMail properties needed according to the SMTP Server used:

mail.smtp.host=localhost

mail.smtp.port=25

mail.transport.protocol=smtp

mail.from=someemailid@localhost

Click on the Next button and select the All servers in the cluster target. Click on the Finish button.

Click on the Activate Changes button to finish.


  • =========================================================
    Steps to create the EmailAlertModule WLDF module:
    ========================================================
    Access the Administration Console with your web browser.
    Click on the Lock & Edit button to start a new edit session.

  • Click to open the Diagnostics tree on the left and then click on Diagnostic Modules.

  • In the Summary of Diagnostic Modules page, click on the New button. Type EmailAlertModule in the Name field and click on the OK button.

  • Click on the newly created EmailAlertModule WLDF module and then on the Targets tab. Select the All servers in the cluster radio button and click on the Save button.

  • Click on the Configuration tab and then the Collected Metrics tab. Change the Sampling Period value to 60000 and click on the Save Button

  • Once we have the system module in place, then configure a Notifcation that references the Mail Session which we have set up previously.


===================================================
To create a watch for a diagnostic system module:
===================================================

  • Click on the Lock & Edit button to start a new edit session.

  • In the left pane, expand Diagnostics and select Diagnostic Modules.

  • On the Summary of Diagnostic Modules page, click the name of the module for which you want to create a watch.

  • On the Settings for EmailAlertModule page, select Configuration > Watches and Notifications > Watches.

  • Click New.

  • On the Create Watch page, do the following:

  • Enter a name for the watch in the Watch Name field, in this case I have created a watch named as EmailAlertWatch

  • Select a watch type from the Watch Type list:

  • Select Collected Metrics to set a watch based on metrics collected from MBean attributes.

  • Select Server Log to set a watch based on data written to server logs.

  • Select Event Data to set a watch based on data generated from a specified instrumentation event.

  • To enable or disable the watch, select or deselect the Enable Watch box.

  • Click Next.

  • Construct a watch rule. See Construct watch rule expressions,

  • You can click Finish at the top or bottom of the Create Watch page to complete the watch rule. Or you can continue on to specify an alarm option for the watch and select
    notifications to associate with the watch. To continue, click Next.

  • On the Create Watch page, select an alarm option. This setting determines when a watch expression will be re-evaluated after it evaluates to true. If a watch is configured as an alarm, then the watch will not be evaluated again until the alarm is reset.

  • Select Don't use an alarm if you want the watch expression to continue to be evaluated without resetting it.

  • Select Use a manual reset alarm if you want to indicate manually when you want the watch expression to be re-evaluated.

  • Select Use an automatic reset alarm if you want the watch expression to be re-evaluated after a specified time. If you select this option, you must also enter the reset period (in seconds).

  • Click Next.

  • To assign notifications for the watch, select and move one or more existing notifications from the Available list to the Chosen list. (You can associate one or more notifications with a single watch.) To create notifications, see Create notifications for watches in a diagnostic system module
    Click Finish.
    To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
    Not all changes take effect immediately—some require a restart.