JMX之(Introduction)
                           
    注:JMX是Jboss等服务器架构使用的一个核心技术,学习JBoss前提,内容主要参考官方文档.


Introduction to JMX Technology


JMX technology provides a simple, standard way of managing resources such as applications, devices, and services. Because JMX technology is dynamic, you can use it to monitor and manage resources as they are created, installed and implemented. You can also use JMX technology to monitor and manage the Java Virtual Machine1 (Java VM).


    JMX技术提供一个简单,标准的方式管理应用程序,设备和服务等资源,一旦这些资源被创建,安装和实现,你能利用JMX的动态特性来监控和管理它们。同时你也可以用JMX来监控和管理JVM
JMX技术基于以下两个JSR开发:
  * JSR 3, Java Management Extensions Instrumentation and Agent Specification
  * JSR 160, Java Management Extensions Remote API



What Is JMX Technology?

The JMX specification defines an architecture, the design patterns, the APIs, and the services for
application and network management and monitoring in the Java programming language.

Using JMX technology, a given resource is instrumented by one or more Java objects known as Managed Beans,
or MBeans. These MBeans are registered in a core managed object server, known as an MBean server, that acts as a management agent and can run on most devices enabled for the Java programming language.


    JMX规范,定义了一个架构、设计模式、APIs和服务,为应用程序和网络提供管理和监控。

    使用JMX,一个给定的资源,如可管理的Beans或者MBeans,可以被一个或者更多个Java对象操作。这些MBeans注册在一个核心的管理对象的Server上。如MBean Server,它当作一个管理的agent,能运行在大部分可用Java激活的设备上。

The specifications define JMX agents that you use to manage resources instrumented in compliance with the
specifications. A JMX agent consists of an MBean server, in which MBeans are registered, and a set of
services for handling MBeans. In this way, JMX agents directly control resources and make them available to remote management applications.

The way in which resources are instrumented is completely independent from the management infrastructure.
Resources can therefore be rendered manageable regardless of how their management applications are
implemented.

JMX technology defines standard connectors (JMX connectors) that allow you to access JMX agents from remote management applications. JMX connectors using different protocols provide the same management interface.
Hence a management application can manage resources transparently, regardless of the communication protocol used. JMX agents can also be used by systems or applications that are not compliant with the JMX
specification but which support JMX agents.


    使用JMX agents管理资源操作必须依照规范。一个JMX agent有一个MBean Server组成,这个MBean Server,提供给MBeans 注册和一些列操作Mbeans服务,这样JMX agents直接控制资源,使得能远程控制应用程序。

    这种方式能使得被操作的资源能彻底的独立于管理的底层结构,不产生任何依赖。资源可以不关心它们的管理程序如何实现。

    JMX技术定义了标准的connectors(JMX connectors),使你能远程访问JMX agents,JMX使用不同的协议提供相同的管理接口,所以管理程序可以透明的管理资源,不用考虑使用哪种通讯协议。JMX agents也可用于支持JMX agents但与JMX规范不一致的系统和应用。

下面的图片可以看出大概结构:







Why Use JMX Technology?

JMX technology provides Java developers across all industries with a flexible means to instrument Java code,
 create smart Java agents, implement distributed management middleware and managers, and smoothly integrate these solutions into existing management and monitoring systems.

JMX技术能提供给所有工业行业的Java开发者一个灵活的mbeans去操作Java代码,创建灵活的Java代理,实现分布式的管理中间件和管理,而且能平稳的集成到已经存在的管理和监控系统中去。

1. JMX technology enables Java applications to be managed without heavy investment: A JMX technology agent
 can run on most Java technology-enabled devices, thus Java applications can become manageable with little
impact on their design. A Java application simply needs to embed a managed object server and make some of
its functionality available as one or several managed beans (MBeans) registered in the object server; that
is all it takes to benefit from the management infrastructure.

JMX使得Java应用可被管理只需要很少的投入:
一个JMX agent能运行在大部分Java激活的设备上,因此Java应用是否可被管理与原来的设计基本没有冲突。Java应用只需要简单的嵌入一个管理对象的Server,并在其上注册一个或多个管理Beans(MBeans)在Server上,使Server上一些功能可用。这就是从管理的基层结构获得的益处。

2. JMX technology provides a standard way to manage Java technology-based applications, systems, and
networks. For example, the Java Platform, Enterprise Edition (Java EE) 5 Application Server conforms to the JMX architecture and consequently can be managed using JMX technology.

JMX提供一个标准的方式管理Java编写的应用,系统和网络,例如:JavaEE 5的应用服务器遵循JMX架构,因此可以使用JMX技术管理。

3. JMX technology can be used for out-of-the-box management of the Java VM. The Java Virtual Machine (Java
VM) is highly instrumented using JMX technology. You can easily start a JMX agent to access the built-in
Java VM instrumentation, and thereby monitor and manage the Java VM remotely.

JMX可以使用于JVM。你可以轻易的启动一个JMX agent 访问这内置的JVM,因此可以远程的管理和监控JVM

4. JMX technology provides a scalable, dynamic management architecture. Every JMX agent service is an
independent module that can be plugged into the management agent, depending on the requirements. This
component-based approach means that JMX solutions can scale from small-footprint devices to large
telecommunications switches and beyond. The JMX specification provides a set of core agent services.
Additional services can be developed and dynamically loaded, unloaded, or updated in the management
infrastructure.

JMX提供一个可升级的,动态管理的构架。每个JMX agent服务都是独立的模块,可以根据需求,可插入管理agent中去。这种基于构件的方式意味着JMX解决方案可以在small-footprint设备和大的 telecommunications之间切换。JMX规范提供一些核心的agent服务,另外的服务可以在管理的底层结构下自行开发,并且能动态加载,移除和修改。

5. JMX technology leverages existing standard Java technologies. Whenever needed, the JMX specification
references existing Java specifications, for example, the Java Naming and Directory Interface (JNDI).

JMX技术利用了以前存在的标准Java技术,例如JNDI

6. Creating JMX applications has been made easier by the creation of a JMX module for the NetBeans IDE 5.0.
 You can obtain the JMX module from the NetBeans Update Center.

使用NetBeans IDE5.0的JMX模块开发JMX应用已经非常容易了。你可以从NetBeans升级重新获得这JMX模块。

7. JMX technology integrates easily with existing management solutions and emerging technologies. For
example, JMX agents could be managed through an HTML browser. The JMX APIs are open interfaces that any
management system vendor can leverage. JMX solutions can use lookup and discovery services and protocols
such as JiniTM network technology and the Service Location Protocol (SLP).

JMX可以容易的集成已经存在的管理方案和技术。例如:JMX agents可以通过HTML浏览器管理,JMX APIs是开放的接口,任何管理系统卖主都可以利用。JMX方案可以使用Jini网络技术和Service Location Protocol (SLP)来查询服务。



参考资源:

  官方文档: http://java.sun.com/javase/6/docs/technotes/guides/jmx/overview/JMXoverviewTOC.html