How to create a WLSDM Generic DevOps MBean

 

An MBean is similar to a Java Bean component.It consists of some variables with getter/setter methods (Arguments) and some custom methods (Operations). We can register an MBean in WebLogic server, its arguments and operations are exposed like WebService. After that, we can access these operations and variables from an external Java class or other applications. For example,  We can expose a DB table CRUD operation in Java MBean and registered in WebLogic server., then any deployed WebLogic application or external Java class can access this MBean. 

 

Creating MBean is little costly, we need to write an Interface,  a JMBean ava class with attributes and methods and need to register it into WebLogic server so others can use it. 

 

WLSDM has a feature called ‘Generic DevOps‘. Using this, we can register a Mbean using a shell/batch commands or SQL Queries. Any Unix/Windows administrator or a DBA can register an MBean in WebLogic server without knowing Java & Deployment. Another feature WLSDM has the smart dashboard. The Smart Dashboard is useful to monitor metrics (any Integer type values). We can assign any MBean metric attribute to the Smart dashboard so a WebLogic Administrator can monitor. Below I summarise the above text 

 

  1. Create an MBean dynamically using WLSDM Generic DevOps Means using a Shell/Batch script or SQL Query 
  2. Apply this MBean attributes to a smart dashboard so the WebLogic administrator can monitor it 

 

Also, any deployed WebLogic application (war or jar file) or external application can access this dynamic MBean. Here below I have mentioned some of  metrics we can create it in WLSDM using Genetic DevOps

 

  1. Measure web service or application response time 
  2. Measure CPU performance like utilization, memory
  3. WebLogic Admin/Managed server consumption, no of threads
  4. An SQL query output, example Salary of an employee 
  5. Deployed application business data, example: number of request the web application received or the total number of users currently logged in. 

 

As I wrote many above, you may think to create this MBean in WLSDM takes much time. I say no you can create it in. 

 

Time to create an MBean and Smart Dashboard (2-3 minutes) + Time you are writing the shell (OR) batch script (OR) SQL, Query 

 

Let’s create an example of MBean in WLSDM and create a dashboard. We create it using the following two points 

  1. Create an MBean using Windows batch command. (A simple windows command output CPU and MEMORY usage)
  2. Assign the CPU and MEMORY usage to a WLSDM smart dashboard  

 

 

WLSDM Generic MBean Example: 

 

1. Log in to the WebLogic console >> Click on the Smart Dashboard Console. This will navigate you to the WLSDM dashboard.

 

011618_0235_Howtocreate1 How to create a WLSDM Generic DevOps MBean

 

 

2. Click on the Monitoring & Diagnostics as shown below. This will take you to the page where we can  create and register the MBean and deploy it in a smart dashboard 

 

011618_0235_Howtocreate2 How to create a WLSDM Generic DevOps MBean

 

3. Click on the Generic DevOps MBeans tab. Here we can see all the existing MBeans. Click on the New Generic DevOps MBean on the right-hand side as shown below to create and register a custom MBean.

 

011618_0235_Howtocreate3 How to create a WLSDM Generic DevOps MBean

 

 

4. This will open a screen as shown below. Here we can select the type (Shell / SQL ) and WebLogic server where the MBean is registered  

 

  • Select the Embedded Script; It allows us to write a shell script or batch script; If the WebLogic server is installed on the Unix flavors then we can write a shell script, On windows then we can write batch commands. WLSDM will take care of executing the commands on the server.
  • Move the WebLogic server instance from Target servers to the Applied Servers. The MBean we are going to create will be deployed only to the Applied Servers

 

Other Supported Types=> Embedded Script OR Load From Executable File OR SQL SCRIPT

 

011618_0235_Howtocreate4 How to create a WLSDM Generic DevOps MBean

 

 

5. This screen is important.; Input your batch/shell commands here and click Transform. This will generate MBeans from the script output.  Once MBeans are generated then click Next

 

  • The first Arrow mark is pointing to a text area where we can write our custom shell/batch commands. The Output of the commands must be KEY=VALUE pair, where the KEY must be string and VALUE must be Integer/Long type. (Click on the Transform button once the script entered)

 

  • The seconds Arrow is pointing to Script Execution Timeout. Here we can specify a maximum time the script can run. Minimum is 0 seconds, and the maximum is 30 seconds. The default value is 5 second.

 

  • The third Arrow is pointing to Generated JMX MBean Attributes. These MBean attributes are generated from the Schell script output (KEY=VALUE), where KEY is the Attribute Name & Value type is the Attribute type. For example, if the script output is TOTAL_MEMORY=700000 then the attribute_name is TOTAL_MEMORY and INTEGER is ATTRIBUTE_TYPE. The value will be generated dynamically at the run time.This batch script returns output like below, now look at the Generated JMX MBean Attribute  

 

 

 

011618_0235_Howtocreate5 How to create a WLSDM Generic DevOps MBean

 

 

6. In this screen, we can create and assign the above generated DevOps MBean attributes to a WLSDM dashboard so that we can see these metrics on the WLSDM screen.

 

  • In the first BOX, I have created a dashboard & moved it to the applied dashboard so the MBeans will be applied to that dashboard. 

 

  • In the second BOX, I input an MBean name. WLSDM will register this MBean in WebLogic

 

  • In the third BOX, I selected Attributes in Different Chart, that means each of the above attribute value will be displayed in a separate chart instead of all in one chart.

 

 

011618_0235_Howtocreate6 How to create a WLSDM Generic DevOps MBean

 

 

7. The above created MBean ( Box -2 ) will be displayed under the Generic DevOps MBeans tab. We can edit it later if we want by click on the pencil icon as shown below

 

011618_0235_Howtocreate7 How to create a WLSDM Generic DevOps MBean

 

 

8. We can view the dashboard by click on the Dashboard >> <DASHOARD_NAME>. (Look at the dashboard name in BOX-1 in Step 6)

 

011618_0235_Howtocreate8 How to create a WLSDM Generic DevOps MBean

 

9. The dashboard will display as below. As you see, each attribute is displayed in a separated chart(See BOX-3 in step 6). It shows the memory and CPU consumptions in a line chart, where TIME as x-axis and the corresponding value as Y-Axis

 

011618_0235_Howtocreate9 How to create a WLSDM Generic DevOps MBean

 

 

Conclusion

 

We can access the above registered MBean attributes in an external application or from a Java program. For example, we can write a Java class that connects to WebLogic server and access these MBean attributes values. WLSDM provides an MBean search console where we can look all the registered MBean in WebLogic server.

As shown below, I navigated to MBean Search console and searched for DevOps; This results in me all the DevOps MBean attributes.

 

011618_0235_Howtocreate10 How to create a WLSDM Generic DevOps MBean

 

 

Here I am accessing the same above MBean attribute in the JConsole which is available under JAVA_HOME\bin\Jconsole.bat:

 

011618_0235_Howtocreate11 How to create a WLSDM Generic DevOps MBean

In my Next post, I will post the following topics

  1. Create an MBean from an SQL query & assign it to a dashboard
  2. Create a dashboard using existing DevOps MBeans 

 

There are wonderful tutorials available on the WLSDM website about Generic DevOps which is shown below 

 

http://blog.wlsdm.com/generic-devops-mbean-screencast-sql-mbean-transformation-on-weblogic/

 

 

govindan How to create a WLSDM Generic DevOps MBean
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan How to create a WLSDM Generic DevOps MBean
Connect me
By | 2018-01-28T17:39:33+00:00 January 16th, 2018|Categories: WebLogic, WLSDM|Tags: , |0 Comments
Like us on Facebook.
Connect!