
The Oracle Weblogic Watch and Notification system can be used to create automated monitors that observe specific diagnostic state and send notifications based on configured rules. More in detail:
- Watch: this component is used to monitor the MBean attributes.
- Notification: this component includes the events which are triggered based on the values set in the watch. There can be different types of alert like SNMP alerts, JMS Messages, JMX notifications etc.
Create a new Notification
In order to create a Notification, you need at first a Diagnostic Unit, such as the Heap Diagnostic that we set up in the earlier section.
Select your Diagnostic Unit and choose, from the Configuration Menu, the Watches and Notifications submenu. From there, select the “Notification” tab and click on the “New” button as depicted by the following picture:
In the next screen, we will be choosing the type of notification we will use among Mail (SMTP), JMS Messages, JMX Notification, SNMP Trap and Diagnostic Image. In our example, we will pick up JMS Messages from the list, which means that notification messages will be delivered using the JMS system:
Next, specify the notification name and if your notification will be enabled by default:
The following screen will be tailored for your notification type: if you selected to receive a JMS notification, then you have to enter the Queue JNDI name and the Connection Factory JNDI name which will be used when Watch events are triggered.
Click Finish to create your Notification. In the next part, we will show how to associate the Notification with a Watch component.
Create a new Watch
In this section we will show how to create a watch that will monitor the attributes of a specific MBean. Select your diagnostic unit and choose, from the Configuration menu, the Watches and Notifications submenu. From there, select the “Watches” tab and click on the “New” button:
The Watch will be based on a set of “Collected Metrics”, therefore, check that this option is selected and that it is “enabled” as shown by the following picture:
Click Next to continue. The Watch will need a rule expression to be checked, so in the following screen choose to add a new rule expression:
Creating a new Rule Expression is quite easy as it can be done by means of an intuitive wizard and some basic operators (“=”,”>”,”<” etc.). Before doing that, in next step we will need to select the MBean we are going to monitor: in our example, weblogic.management.runtime.JVMRuntimeMBean. Done with the MBean, in the next screen we will select the attribute you want to monitor and specify a value for that rule. As shown by the following picture, we are going to watch the HeapSizeMax attribute, specifying as rule “> 200”:
The last screen will recap your current rule, letting you to add some more expressions, combine with existing rule expressions or simply finish the rule creation.
As last effort, select the JMS Notifier from the list on the left side and click on “>” or “>>” so that it is associated with the watch created. Once done, click Finish.
Target the WLDF to any of the servers where MBeans will be monitored. Now check server logs, where you can verify that your alarms are being triggered.