Configuration: WLDF Mail Notification for Runtime Mbean

Weblogic Diagnostics Framework can be used to analyze, collect, archive and access diagnostic data generated by a running server and the applications deployed within its containers.

Here I have provided configuration for sending mail notification on the harversted data for the runtime Mbean which you want to monitor.

1. From <domain_name> -> Diagnostics -> Diagnostics Module Create a diagnostic module and target it to server for which WLDF module has to be used.


<domain_name>

<domain_name>

<domain_name>


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

2.

For the Diagnostics module created in step 1, create a Collection metrics for mbean you want to monitor:

a) Click on ‘New’ to create a Collection Metrics


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

b) Select the Mbean Server location for which we want to collect data. It can be DomainRuntime or ServerRuntime Mbean.


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

c) Select the Mbean which has to be monitored


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

d) Select the Attributes which you want to collect for the Runtime Mbean selected in Step 2(c)


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

3) Create a mail session from Services -> Mail Session

a) Specify and JNDI name for mail session and the following as mail session properties:

mail.smtp.host=xxxxxxxx

mail.smtp.user=xxxxxxxxxxxxxx


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

b) Target the mail session to a server


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

4) Creating a Notification:

a) From Diagnostics -> Diagnostics Module -> Watches and Notification, Create a New Notification. Specify Notification Type as SMTP (email).Here Keep ‘Enable Notification’ as Checked and click ‘Next’


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

b) Here select the Mail session which we configured in Step 3 along with the Email Recipients who will be receiving the mail notification for Runtime mbean. Here we can edit the format of Email notification. Click Finish.


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

5) Create a Watch for Runtime mbean which was mentioned in Collection Metrics configured in Step 2 (Can be Server Log as well):

a) Select the Mbean location


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

b) Select Mbean to be monitored


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

c) Select instance for which the Mbean has to be monitored. (Only one instance can be selected at a time. Note: If we want to monitor Runtime Mbean for more than one instance then we can add expression selecting the same mbean for other servers. Refer Step 5-f)


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

d) Select the attribute for which watch has to be configured and apply desired operation to it. Attribute should be same as what we have configured in Collection Metrics.


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

f) Verify the Watch Rule Expression created from the previous steps followed. If you want the same mbean to be monitored for more than one server then click on ‘Add Expression’ tab follow steps 5-a through 5-e for other server instance. We can use ‘AND’/’OR’ operations to create Watch Rule as per requirement.


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

g) Select Alarm on the watch


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

h) Select the notification which we created in step 4 and Click Finish


/* Style Definitions */ table.MsoNormalTable {mso-style-name:”Table Normal”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:”Times New Roman”; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

After all the above setting we will get an email update if the condition mentioned in the watch rule is met.

13 comments

  1. Thanks Anshul for taking the pain of creating such a nice article and then takin the pain of uploading all those images.. Good Bless You 🙂

  2. Thanks you first.this article is so detailed with description and images,i think i should config this by your step. some days ago ,someone ask the question about Notification by email in our qq group. this article maybe help him.

  3. i have configured this step by step but ,in WLS9.2 i do not find this “Select instance for which the Mbean”, after i create watch,and then i can not find the instance page to select ,it is direct to show the Configure Watch Rule Expressions page. so can u help me ?

  4. This is a difference in configuration of Diagnostics module in WLS 9.2 and WLS 10.3 configuration. You can skip this step if you working with WLS 9.2. From 10.3 onwards we can configure diagnositcs notification for each instance.

    Regards,
    Anshul.

  5. do i need to download an email client on the server that’s hosting a weblogic server or my company’s exiting client somewhere else should do the trick? Is there a way to send out test email to see the email notification works? For some reason i couldnt get the email thing to work even though i was able to set watches and rules…

  6. You need not download any client, you can use your company’s SMPT server details (If you can access them. 🙂 ).

    Configure a mail session providing the SMTP server details.

    Steps to configure a mail session are below.

    http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13952/taskhelp/mail/CreateMailSessions.html

    Testing the setup: The email is triggered as soon as the condition / rule defined is met. For example if you are monitoring a server shutdown state and if the server gets shutdown. Then it would automatically trigger an email notification.

    Regards,
    Anandraj

  7. hi

    I configure ecaxctly wat u said!
    the following exception is raised…

    i.e smtp connection refused

    <Watch 'Heap_Notification' with severity 'Notice' on server 'AdminServer' has triggered at May 16, 2012 10:48:25 AM IST. Notification details:
    WatchRuleType: Harvester
    WatchRule: (${ServerRuntime//[weblogic.management.runtime.JVMRuntimeMBean]com.bea:Name=AdminServer,ServerRuntime=AdminServer,Type=JVMRuntime//HeapFreePercent}
    <Mail notification has not been sent due to an error that occurred while creating or sending a mail message:
    com.bea.diagnostics.notifications.NotificationPropagationException: javax.mail.MessagingException: Could not connect to SMTP host: 192.168.1.152, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused
    at com.bea.diagnostics.notifications.SMTPNotificationService.send(SMTPNotificationService.java:253)
    at weblogic.diagnostics.watch.SMTPNotificationListener.processWatchNotification(SMTPNotificationListener.java:218)
    at weblogic.diagnostics.watch.Watch.performNotifications(Watch.java:621)
    at weblogic.diagnostics.watch.Watch.evaluateHarvesterRuleWatch(Watch.java:519)
    at weblogic.diagnostics.watch.WatchManager.evaluateHarvesterRules(WatchManager.java:393)
    Truncated. see log file for complete stacktrace
    Caused By: javax.mail.MessagingException: Could not connect to SMTP host: 192.168.1.152, port: 25;
    nested exception is:
    java.net.ConnectException: Connection refused
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
    at javax.mail.Service.connect(Service.java:288)
    at javax.mail.Service.connect(Service.java:169)
    at javax.mail.Service.connect(Service.java:118)
    Truncated. see log file for complete stacktrace
    Caused By: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

    please help me….

    Regards,
    BalaSatish Kamma

    1. Hi Bala,

      Do you have a mail server running on SMTP host: 192.168.1.152, port: 25

      You can install some free email servers to get it work..

      Thanks,
      Faisal

  8. Hello,
    Could you suggest how to disable JMX logs in weblogic server?

    Thanks & Regards

    1. Hi Pooja,

      you mean disable logging using jmx?

      I am not sure what jmx logs are..

Comments are closed.