JMX usage Summary

Source: Internet
Author: User

JMX (Java Management Extensions) is a set of Java-based network management system solution specifications. JMX defines a complete set of architecture and design patterns for the network management system to implement various management operations, while Jdmk is the first commercial product of JMX, Which is JMX (Java Management Extensions) it provides a framework for managing Java objects through Java applications. Advantages of using JMX:
1> enhanced system configuration: if the system is not restarted, the modified configuration file takes effect. For example, database connection configuration and log information-level Configuration
2> dynamic loading of new modules
3> modularize the application and replace or remove modules in the running program
4> monitor some operations or variables in the program-alarm

<1> describe four types of mbeans In the instrumentation layer:

1> standard mbean
It consists of mbean interface and class that implements this interface. The mbean Interface contains the variables and operable methods for the Administrator to see through the remote client.
2> dynamic mbean
A class that implements the dynamicmbean interface. You can directly declare the variables and operation methods that the administrator can see in the remote client. You do not need to write another mbean interface for this purpose. In this way, you can dynamically configure remote operations as needed.
The following sections must be implemented in the class:
An object finally implemented by mbeaninfo. The parameters of this class constructor include the array returned by all other parts below.
Mbeanoperationinfo
Mbeanconstructorinfo
Mbeanparameterinfo
Mbeanattributeinfo initializes variables that can be viewed by administrators.
Mbeannotificationinfo initialize the variables and operations to be monitored
3> model mbean
It consists of requiredmodelmbean, model mbean metadata, and target object (s. The model mbean metadata can be initialized by the xml configuration file. Because the implementation of model mbean inherits dynamic mbean, the implementation method of model mbean is similar to dynamic mbean, and the structure is similar to dynamic mbean.
Note: 1. You can use the utilities. convertxmltomodelmbeaninfo ("serverinfo. xml") method in the xmojo. jar package of adventnet to load the XML file.
2. Because the class cannot be found frequently during running, try to include the path when introducing the class name, such as com. Neu. mbean. xmodel. serverinfo.

<2> three services contained in the agent layer (monitoring and alarms can be implemented in the program) are described as follows:

1> timer Service
An alarm is triggered in the following situations:
1. Only alarm once at the specified time
2. Repeated alarms within a specified time range
2> Monitor Service
An alarm is triggered in the following situations:
1. Alarm after a specified trigger event occurs
2. An alarm is triggered when an error occurs during monitoring of the specified attribute.
There are three types of monitor:
A. counter monitor generates an alarm when the value of the monitored variable is greater than or equal to the specified value.
B. When the value of the monitored variable is greater than or equal to the specified maximum value, gauge monitor generates an alarm.
C. String monitor generates an alarm when the monitored string matches or does not match the specified string.
3> M-Let Service
One or more mbeans remotely obtained can be registered to the mbean server. The mbean remote path and other configurations are included in an M-Let file.

Add a JMX solution to the existing management system(Instead of using the htmladaptorserver provided by JMX, you can add a new page to the existing management system to manage mbeans ):
1> Create mbeanserver In the servlet initialization method and register the required mbean as follows:
Mbeanserver Server = mbeanserverfactory. creatembeanserver ("local ");
Objectname ob_name = new objectname ("mbeaninfo", "name", "simplestandard ");
Server. creatembean ("org. webjmx. example. simplestandard", ob_name );
Objectname ob_name = new objectname ("mbeaninfo", "name", "simpledynamic ");
Server. creatembean ("org. webjmx. example. simpledynamic", ob_name );
2> the management interface is implemented through the open-source project webjmx (which makes it easy to compile the JMX tag of the management interface for mbean management), as follows:
<JMX: getmbeanserver id = "server" attribute = "locator"/>
<JMX: getfeaturebyname id = "attribute" name = "attrs" featurename = "state"/>
<JMX: getfeaturebyname id = "operation" name = "mbi" property = "operations" featurename = "reset"/>
For details, refer to the example in the webjmx package.

Reference: http://www.xmojo.org/products/xmojo/docs/index_no_frames.html

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.