Setting up Watches and Notifications in Weblogic Server
About
Blog
Privacy Policy
SiteMap
As any IT system administrator knows, it’s crucial to get informed in time of events and certain metrics levels occurring in the systems that you are responsible for. It’s the same with any Fusion Middleware platform, and this kind of functionality is covered by both the Enterprise Manager Grid Control, but also by the Weblogic Server itself. So if you are only using the Weblogic Administration console for monitoring your Weblogic platform, you can still set up alerts to inform you about the state of your system. This post will cover just such a setup that will send email notifications to the administrators, although SNMP traps, JMX, and JMS are also supported.
To set up your email alerts you will need to cover these main steps:
In our specific case of email notifications, you need to set up a JavaMailSession object, that will actually be used by the Notifications to send the alerts through the specified email server;
Set up a diagnostic module and define any metrics that you would like to collect;
Define the Watches you are interested in – this is the situation that you want to trigger your alert. It can be a certain message in the log files, or a certain value of a collected metric, or a certain event occurring in the system.
Define the Notifications you would like to receive and associate the Watch to a Notification;
In the below example, we will set up alerts on the state of the Weblogic Managed Server, so the admin will get a notification when a server is not in the RUNNING state.
Note that the JavaMailSession itself does not offer email server capabilities, but it only provides the JavaMail API so that applications can send and receive email from an already existing server.
a) Click “Lock & Edit” to acquire a configuration lock
b) Expand Services -> Mail Sessions and click “New” to create a new Java Mail Session object
c) Provide Name, JNDI Name and JavaMail Properties as follow:
Name – WLSAlertsMailSession
JNDI Name – WLSAlertsMailSession
(You may enter whatever value here, but it’s best to keep the same value for the two names)
JavaMail Properties :
mail.debug=”true” – not mandatory, but recommended should you want to troubleshoot why your alerts are not getting through
mail.smtp.port=25
mail.smtp.from=”soa_admin@oraclemiddlewareblog.com”
mail.smtp.host=email.server.example.com
d) Click next to target the mail session to a server (either managed or AdminServer) and click finish. You need to do this so that the MailSession is exposed on the servers JNDI tree.
e) Activate the changes by clicking “Activate Changes”.
You can actually test that your JavaMail properties are correct and that you can send email messages via the email server specified by following the steps described in this post: Email Test
a) Expand Diagnostics -> Diagnostics Modules and click “New” to create a new diagnostics module. Provide a name and description.
Name – DiagModuleWLDF
Description – This is a WLDF module for testing email notifications
b) Select the newly created module and select “Targets” tab. Select the appropriate server for target as before
c) Click “Save” and “Activate”
d) Click “Lock & Edit” to acquire a new configuration lock
e) Click on the “Collected Metrics” tab and click “New”
f) Select “ServerRuntime” and click “Next”
g) Select “ServerRuntimeMBean” from the dropdown
h) From the list of collected attributes select “State” and move it in the “Chosen” category; Click “Next”
i) From the instances list select the servers you would like to be informed about by selecting an instances and moving it to the “Chosen” category
j) Click “Finish”
k) Click “Save” and “Activate”
Notice that this metric is collected at a configurable interval, by default 300000ms
b) Navigate to the diagnostic module created above (DiagModuleWLDF) and select the “Watches and Notifications” tab and “Watches” sub-tab (if not already selected)
c) Click “New” to create a new Watch. Provide the name and select the type as “Collected Metrics”. Also make sure the watch is enabled.
Name – ServerStateWatch
d) Click “Next”
e) Click “Add Expressions”
f) Ensure that “ServerRuntime” is selected and click “Next”
g) From the dropdown, select “ServerRuntimeMBean” again. The click “Next”
h) Select the instance for the appropriate server from the list for “Instance” and click “Next”
i) For “Message Attribute” select “State”, “!=” for “Operator” and type “RUNNING” (all capital letters) for “Value”. Click “Finish” the Watch
j) Activate the changes
This Watch will now be triggered every time the server state is other than RUNNING. Please note that this is dependent on the Collected Metric’s sampling period as well.
b) Navigate to the diagnostic module created above and select the “Watches and Notifications” tab and “Notification” sub-tab
c) Click “New” to create a new Notification
d) Select “SMTP (E-Mail) for Type and click “Next”
e) Provide a name – ServerStateNotification. The notification must be enabled, of course. Click “Next”.
f) Configure the following properties for the “Config Notification – SMTP Properties” page
g) Mail Session Name – WLSAlertsMailSession
h) E-Mail Recipients – admin@oraclemiddlewareblog.com
i) Click “Finish”.
To associate the watch and the notification:
c) Select the watch you created earlier – ServerStateWatch
d) Select the “Notifications” tab and move the “ServerStateNotification” from Available to Chosen
e) Click “Save”
f) Select the “Alarms” tab and select “Use an automatic reset alarm”. Set the “Automatic reset period” so that you don’t get spammed with alerts email and click “Save”.
g) Click “Activate Changes
And that’s it. Next time one of your servers is in a state other than RUNNING (and is picked up by the collected metric based on the sampled period), you will receive an email in the form of:
Of course, both the Subject and the Body of the mail can be customized in the Administration console, in the notification section.
Share
Tweet
← „No buffer space available” while starting SOA 11g managed server
What’s new in Oracle Weblogic Server 12c →
Karan January 15, 2014 at 7:05 am I believe u forgot to provide the link to test the javamail properties. Excellent post otherwise! Thanks a tonne Reply ↓ radudobrinescu Post author January 15, 2014 at 4:04 pm Thank you, Karan! The link is fixed now. Reply ↓
I believe u forgot to provide the link to test the javamail properties. Excellent post otherwise! Thanks a tonne
radudobrinescu Post author January 15, 2014 at 4:04 pm Thank you, Karan! The link is fixed now. Reply ↓
Thank you, Karan! The link is fixed now.
Robinson March 24, 2014 at 9:10 am I have followed all the steps given above .. but unable to receive the mail … I have checked the SMTP Server also, its working…. Reply ↓ Radu Dobrinescu Post author March 25, 2014 at 1:46 pm Hi, Have you tested the email server by the instructions in this post? http://oraclemiddlewareblog.com/2012/01/05/sending-emails-via-command-line/ If that works and you are able to receive the mail, make sure that the Watch you have defined is actually trigerred. Check the log file for that. Otherwise, make sure all objects are targeted to the correct servers and that there are no typos in the settings… Good luck! Radu Reply ↓
I have followed all the steps given above .. but unable to receive the mail … I have checked the SMTP Server also, its working….
Radu Dobrinescu Post author March 25, 2014 at 1:46 pm Hi, Have you tested the email server by the instructions in this post? http://oraclemiddlewareblog.com/2012/01/05/sending-emails-via-command-line/ If that works and you are able to receive the mail, make sure that the Watch you have defined is actually trigerred. Check the log file for that. Otherwise, make sure all objects are targeted to the correct servers and that there are no typos in the settings… Good luck! Radu Reply ↓
Have you tested the email server by the instructions in this post? http://oraclemiddlewareblog.com/2012/01/05/sending-emails-via-command-line/
If that works and you are able to receive the mail, make sure that the Watch you have defined is actually trigerred. Check the log file for that.
Otherwise, make sure all objects are targeted to the correct servers and that there are no typos in the settings…
Good luck! Radu
Hrushikesh April 2, 2014 at 11:24 pm Can you please help me in customizing the subject/body of the email – I wanted something like “Alert on at ” instead of OOB subject. When I chose custom subject, it only takes static string – Can this be configured? Reply ↓ Radu Dobrinescu Post author April 4, 2014 at 7:45 am Hi, only static text can be added to the customized subject. Reply ↓
Can you please help me in customizing the subject/body of the email – I wanted something like “Alert on at ” instead of OOB subject. When I chose custom subject, it only takes static string – Can this be configured?
Radu Dobrinescu Post author April 4, 2014 at 7:45 am Hi, only static text can be added to the customized subject. Reply ↓
Hi, only static text can be added to the customized subject.
Pingback: Dealing with Stuck Threads in WebLogic | Oracle Fusion Middleware
Pingback: Get Email Notifications about Configuration Changes Performed in the WebLogic Domain - Oracle Middleware Blog
Vengat Maran May 2, 2015 at 8:28 am Nice blog… Reply ↓
Nice blog…
tatstep November 20, 2015 at 12:44 pm did not work for me! Reply ↓ tatstep November 20, 2015 at 12:49 pm I followed all steps, but this configuration did not work for me. No notifications in my mailbox, no info in mail logs and no info in AdminServer logs. The test on send mail via command line sending did work, but via weblogic notification not! Any idea? Weblogic issue? Reply ↓ Radu Dobrinescu Post author November 20, 2015 at 2:52 pm Hi, If there are no messages in the log files, you should double check the criteria for triggering the watch and make sure it is enabled. Try first with a basic criteria just to verify that it works. You should see the watch being triggered in the log file. Regards Reply ↓
did not work for me!
tatstep November 20, 2015 at 12:49 pm I followed all steps, but this configuration did not work for me. No notifications in my mailbox, no info in mail logs and no info in AdminServer logs. The test on send mail via command line sending did work, but via weblogic notification not! Any idea? Weblogic issue? Reply ↓ Radu Dobrinescu Post author November 20, 2015 at 2:52 pm Hi, If there are no messages in the log files, you should double check the criteria for triggering the watch and make sure it is enabled. Try first with a basic criteria just to verify that it works. You should see the watch being triggered in the log file. Regards Reply ↓
I followed all steps, but this configuration did not work for me. No notifications in my mailbox, no info in mail logs and no info in AdminServer logs. The test on send mail via command line sending did work, but via weblogic notification not! Any idea? Weblogic issue?
Radu Dobrinescu Post author November 20, 2015 at 2:52 pm Hi, If there are no messages in the log files, you should double check the criteria for triggering the watch and make sure it is enabled. Try first with a basic criteria just to verify that it works. You should see the watch being triggered in the log file. Regards Reply ↓
If there are no messages in the log files, you should double check the criteria for triggering the watch and make sure it is enabled. Try first with a basic criteria just to verify that it works. You should see the watch being triggered in the log file.
Regards
Anonymous September 8, 2016 at 12:50 pm We are getting mails when server state is in RUNNING but not in SHUTDOWN or the other state. What might be the issue in this case? What can we follow inorder to get the mail in those states as well? Reply ↓ Radu Dobrinescu Post author September 8, 2016 at 1:00 pm You should check the Watch rule that you are using. Make sure the syntax is correct, probably it would be more useful to get emails whenever the servers are in any state other than RUNNING. That would be a watch rule like this: (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=AdminServer,Type=ServerRuntime//State} != ‘RUNNING’) Reply ↓ Anonymous September 9, 2016 at 6:23 am yes the same watch rule we has applied. but still we are unable to get mails. Reply ↓ Anonymous September 9, 2016 at 6:26 am The following is the watch rule we applied. ((${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed2_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=admin_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’)) and even tried with this also (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} != ‘RUNNING)) Reply ↓ Asitha Wimalasena October 7, 2016 at 6:32 am I have also experienced this issue. You will not get a notification if the server is down. It’s not a problem in your rule. I think it’s the way this is designed. When the server is down Mbean instance used in the watch rule will not be available. So when evaluating the rule it will evaluate to false, since it will not find a MBean instance to check the status. If you enable debugging for diagnostics you can see this in the Admin Server log. Also before you create the watch rule shutdown one of the managed servers and you will see that you wouldn’t get that instance in the instance drop down. Reply ↓
We are getting mails when server state is in RUNNING but not in SHUTDOWN or the other state. What might be the issue in this case? What can we follow inorder to get the mail in those states as well?
Radu Dobrinescu Post author September 8, 2016 at 1:00 pm You should check the Watch rule that you are using. Make sure the syntax is correct, probably it would be more useful to get emails whenever the servers are in any state other than RUNNING. That would be a watch rule like this: (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=AdminServer,Type=ServerRuntime//State} != ‘RUNNING’) Reply ↓ Anonymous September 9, 2016 at 6:23 am yes the same watch rule we has applied. but still we are unable to get mails. Reply ↓ Anonymous September 9, 2016 at 6:26 am The following is the watch rule we applied. ((${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed2_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=admin_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’)) and even tried with this also (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} != ‘RUNNING)) Reply ↓ Asitha Wimalasena October 7, 2016 at 6:32 am I have also experienced this issue. You will not get a notification if the server is down. It’s not a problem in your rule. I think it’s the way this is designed. When the server is down Mbean instance used in the watch rule will not be available. So when evaluating the rule it will evaluate to false, since it will not find a MBean instance to check the status. If you enable debugging for diagnostics you can see this in the Admin Server log. Also before you create the watch rule shutdown one of the managed servers and you will see that you wouldn’t get that instance in the instance drop down. Reply ↓
You should check the Watch rule that you are using. Make sure the syntax is correct, probably it would be more useful to get emails whenever the servers are in any state other than RUNNING. That would be a watch rule like this:
(${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=AdminServer,Type=ServerRuntime//State} != ‘RUNNING’)
Anonymous September 9, 2016 at 6:23 am yes the same watch rule we has applied. but still we are unable to get mails. Reply ↓
yes the same watch rule we has applied. but still we are unable to get mails.
Anonymous September 9, 2016 at 6:26 am The following is the watch rule we applied. ((${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed2_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=admin_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’)) and even tried with this also (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} != ‘RUNNING)) Reply ↓ Asitha Wimalasena October 7, 2016 at 6:32 am I have also experienced this issue. You will not get a notification if the server is down. It’s not a problem in your rule. I think it’s the way this is designed. When the server is down Mbean instance used in the watch rule will not be available. So when evaluating the rule it will evaluate to false, since it will not find a MBean instance to check the status. If you enable debugging for diagnostics you can see this in the Admin Server log. Also before you create the watch rule shutdown one of the managed servers and you will see that you wouldn’t get that instance in the instance drop down. Reply ↓
The following is the watch rule we applied. ((${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed2_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=admin_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’) OR (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} = ‘SHUTDOWN’))
and even tried with this also (${ServerRuntime//[weblogic.management.runtime.ServerRuntimeMBean]com.bea:Name=managed1_MIDomain,Type=ServerRuntime//State} != ‘RUNNING))
Asitha Wimalasena October 7, 2016 at 6:32 am I have also experienced this issue. You will not get a notification if the server is down. It’s not a problem in your rule. I think it’s the way this is designed. When the server is down Mbean instance used in the watch rule will not be available. So when evaluating the rule it will evaluate to false, since it will not find a MBean instance to check the status. If you enable debugging for diagnostics you can see this in the Admin Server log. Also before you create the watch rule shutdown one of the managed servers and you will see that you wouldn’t get that instance in the instance drop down. Reply ↓
I have also experienced this issue. You will not get a notification if the server is down. It’s not a problem in your rule. I think it’s the way this is designed. When the server is down Mbean instance used in the watch rule will not be available. So when evaluating the rule it will evaluate to false, since it will not find a MBean instance to check the status. If you enable debugging for diagnostics you can see this in the Admin Server log. Also before you create the watch rule shutdown one of the managed servers and you will see that you wouldn’t get that instance in the instance drop down.
Tanuja September 9, 2016 at 6:22 am We are getting mails when server is in Running state but not for the other states like UNKNOWN,SHUTDOWN even after changing rule expressions to server state equals SHUTDOWN What might be the issue here and what can we do in order to get the mails in those states as well. Reply ↓
We are getting mails when server is in Running state but not for the other states like UNKNOWN,SHUTDOWN even after changing rule expressions to server state equals SHUTDOWN What might be the issue here and what can we do in order to get the mails in those states as well.
Jay September 23, 2016 at 2:19 pm Thanks for the very helpful post. But we use Weblogic 12C, and could not find anything like Watch rules. But it has things like ‘Policies & Actions’ Have they changed that in latest version. Please help. Thanks Reply ↓ Radu Dobrinescu Post author September 23, 2016 at 3:00 pm Hi Jay! Yes, starting with 12.2.1 watches and notifications have been renamed to policies and actions. Regards, Radu Reply ↓ Jay September 23, 2016 at 3:03 pm Thanks, I need to send email notifications when a domain or server goes down. I am not sure how to configure the Policy & Actions in 12c. Do you have any examples please ? Reply ↓ Radu Dobrinescu Post author September 23, 2016 at 3:13 pm You should be able to use the instructions in this article. Nothing else changed besides the naming. Reply ↓
Thanks for the very helpful post. But we use Weblogic 12C, and could not find anything like Watch rules. But it has things like ‘Policies & Actions’ Have they changed that in latest version. Please help. Thanks
Radu Dobrinescu Post author September 23, 2016 at 3:00 pm Hi Jay! Yes, starting with 12.2.1 watches and notifications have been renamed to policies and actions. Regards, Radu Reply ↓ Jay September 23, 2016 at 3:03 pm Thanks, I need to send email notifications when a domain or server goes down. I am not sure how to configure the Policy & Actions in 12c. Do you have any examples please ? Reply ↓ Radu Dobrinescu Post author September 23, 2016 at 3:13 pm You should be able to use the instructions in this article. Nothing else changed besides the naming. Reply ↓
Hi Jay! Yes, starting with 12.2.1 watches and notifications have been renamed to policies and actions.
Regards, Radu
Jay September 23, 2016 at 3:03 pm Thanks, I need to send email notifications when a domain or server goes down. I am not sure how to configure the Policy & Actions in 12c. Do you have any examples please ? Reply ↓ Radu Dobrinescu Post author September 23, 2016 at 3:13 pm You should be able to use the instructions in this article. Nothing else changed besides the naming. Reply ↓
Thanks, I need to send email notifications when a domain or server goes down. I am not sure how to configure the Policy & Actions in 12c. Do you have any examples please ?
Radu Dobrinescu Post author September 23, 2016 at 3:13 pm You should be able to use the instructions in this article. Nothing else changed besides the naming. Reply ↓
You should be able to use the instructions in this article. Nothing else changed besides the naming.
Anonymous September 27, 2016 at 6:13 am will the same kind of mail notification possible for JMS Servers? Reply ↓ Radu Dobrinescu Post author September 27, 2016 at 6:17 am Yes. You just need to browse the Mbean tree and find the appropriate JMS Server metric to trigger your Watch. Reply ↓
will the same kind of mail notification possible for JMS Servers?
Radu Dobrinescu Post author September 27, 2016 at 6:17 am Yes. You just need to browse the Mbean tree and find the appropriate JMS Server metric to trigger your Watch. Reply ↓
Yes. You just need to browse the Mbean tree and find the appropriate JMS Server metric to trigger your Watch.
Vepakshi March 23, 2018 at 5:39 pm I have followed the above steps exactly , but no mail is triggered. I have tried to trigger email from command prompt and it worked. Can you let me know where am doing wrong and why mail is not triggered? Reply ↓
I have followed the above steps exactly , but no mail is triggered. I have tried to trigger email from command prompt and it worked. Can you let me know where am doing wrong and why mail is not triggered?
WOGE May 6, 2018 at 5:44 pm Dear weblogic bloggers, I need your support how to configure weblogic send mail via exchange servers. Reply ↓
Dear weblogic bloggers, I need your support how to configure weblogic send mail via exchange servers.
Your email address will not be published.
Comment
Name
Website
Notify me of follow-up comments by email.
Notify me of new posts by email.
Dealing with Stuck Threads in WebLogic
Unable to start WLST: "Could Not Find or Load Main Class weblogic.WLST"
WebLogic AdminServer startup and shutdown scripts
WebLogic 12c Enterprise Deployment Architecture in the Amazon Cloud
How To Improve Weblogic Servers Startup Time
Weblogic Domain Startup and Status check WLST scripts
Setting up Watches and Notifications in Weblogic Server
Cannot connect to Node Manager. : Access to domain for user 'weblogic' denied
Node Manager as Linux service and Weblogic server autorestart
Unable to start Weblogic: PasswordEncrypted of ServerStartMBean