Advanced WebLogic Monitoring: JMX MBean Tutorial
Develop JMX MBeans and Automate with WLSDM Metric Actions
This tutorial is prepared for Advanced WebLogic Administration and Automation. Setting up internal JMX MBean objects are the “best and ultimate practice” for application monitoring infrastructure.
- How to develop and register JMX MBean to Oracle WebLogic Server?
- How to check SERVER disk space by using JMX MBean on WebLogic?
- How to define WLSDM User-Defined Metric Actions?
- How to delete or move Application logs automatically when given threshold exceeds for disc usage on SERVER?
Problem: The application which is deployed to Oracle WebLogic Server 12c (18.104.22.168) is increasing server disk space continuously and in peak times it makes the server disk usage 100%. Meanwhile, the service goes down and causes the service down-time.
- Develop JMX MBeans which check server disk usage (JMX StandardMBean)
- Create alarm and notify when the disk usage exceeds 95% (JMX MBean Monitoring - UsedDiskSpace)
- Create “User-Defined Metric Action” on WLSDM which is targeted to “delete or move application logs”
- When UsedDiskSpacepercentage higher than the given threshold, “ClearLogs” metric action would be triggered by WLSDM and all application logs would be deleted automatically. That means “NO Down-time” with advanced WebLogic monitoring and automation.
Video Tutorial :
Tutorial is prepared for this problem and for any other similar problems.
The tutorial is short and targeted to overcome SERVER disk problem.
How to develop your own JMX MBean and JMX Metric Action? (SUMMARY)
Above video tutorial and sample project quite enough to setup an advanced WebLogic monitoring and automation infrastructure. Senior WebLogic Administrators, DevOps or Developers had better consider every problematic issue while managing mission-critical WebLogic domains.
- Login to WebLogic Console
- Go to WLSDM Console Metric Browser Page
WebLogic Monitoring Dashboard: WLSDM Console
- WLSDM Metric Browser displays all WebLogic JMX MBeans dynamically.
- Go to “WLSDM Console > Configuration > Metric Browser”
2. Check new deployed JMX Custom MBeans on WLSDM Metric Browser page for DiskSpaceWatcher MBeans. Anymore FreeDiskSpace and UsedDiskSpace JMX MBeans are visible on WLSDM v3.9.1 Metric Browser.
Custom WebLogic JMX MBeans
3. Create new Dashboard and name it DiskSpaceWatch.
4. Add FreeDiskSpace and UsedDiskSpace JMX Metrics to DiskSpaceWatch Dashboard and save all.
Adding Custom JMX Metrics to WLSDM Dashboard
5. Anymore Custom JMX MBeans that we developed and its values can be visualized on WLSDM Console Smart Dashboards. You would see two charts on DiskSpaceWatch dashboard as below.
WLSDM JMX Metric Dashboard: Grid View
Dynamic JMX MBean Charts-1: Free Disk Space
Dynamic JMX MBean Charts-2: Used Disk Space
6. Set threshold values for FreeDiskSpace and UsedDiskSpace MBeans and see what will happen? Test it by setting low thresholds. For instance, set the threshold value for UsedDiskSpace to “60” and get below notifications.JMX MBean monitoring alarms would be generated by WLSDM as page and email Notification.
WLSDM: JMX Metric Page Notification
WLSDM: JMX Metric Email Alarm
7. Now Define Custom Metric Actions for FreeDiskSpace:
Custom metric actions can be defined on WLSDM. Now going to create a custom action for FreeDiskSpace metric.
8. Go to “Configuration > User-Defined Metric Actions” Page.
WLSDM Actions: User-Defined Metric Actions
9. Create new “User-Defined Metric Action” as below.
WLSDM: User-Defined JMX Metric Actions
10. Note: “Executable Target Files” can be .SH or .BAT file. System Parameters such as $METRIC_NAME, $METRIC_VALUE can be passed to “Executable Target File” as an argument by WLSDM.
11. Content of “clearlogs.bat” file:
12. Anymore “ClearLogs” Cusom Action can be listed on Actions Window. Select “ClearLogs”.
WLSDM Metric Actions: Select ClearLogs
13. Reset UsedDiskSpace or FreeDiskSpace Metric threshold value and get METRIC CLEAR alarm from WLSDM. (For testing ClearLogs action)
14. Reassign threshold value for FreeDiskSpace metric and get METRIC WARNING alarm from WLSDM. (ie. set lower than 30)
15. Oops! FreeDiskSpace alarm generated! And ClearLogs action has been executed automatically. All logs under C:\wlsdm\logs has been deleted.
WLSDM JMX HTML Email Alert: User-Defined Metric Action
Monitoring is meaningful and powerful with automation