JMX简介
2014-12-17
几点:
- JMX是干什么的?为什么有JMX?
- JMX怎么用?
- Jconsole怎么配合?
- 怎么与Jmxtrans配合?(本质就是使用Jmxtrans的作用,如何安装、使用)
分析
本段大概说一下,面对JMX这一JDK中重要的一个模块,自己认为较为高效的学习思路。上官网,再到Java SE Technical Documentation,再到Tutorial中找到JMX的教程;同时,也可以在Java SE Documentation中直接点击JMX即可。当然,上面锁定jmx信息源的方法并不唯一,最简单的方法,直接在google上检索JMX关键字也可以找到官网对JMX的详细介绍。
JMX是做什么的?
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solutions for managing and monitoring devices, applications, and service-driven networks. By design, this standard is suitable for adapting legacy systems, implementing new management and monitoring solutions, and plugging into those of the future.
Starting with the J2SE platform 5.0, JMX technology is included in the Java SE platform. Please see the JMX documentation for the J2SE 5.0 and Java SE 6 platforms.
notes(ningg):JMX(Java Management eXtensions)用于监控系统运行状态。
JMX怎么用?
JMX(Java Management eXtensions),涉及几个术语:
- MBeans:
- ObjectName:MBean name,或者是a pattern(用于匹配多个MBean name);
- JMX agent:其中包含JMX connector;
- Remote Management:
MBeans
ObjectName
参考来源:http://www.oracle.com/technetwork/java/javase/tech/best-practices-jsp-136021.html
格式:
domain: key-property-list
For example:
com.sun.someapp:type=Whatsit,name=25
简要说几点注意事项:
- 空格是有含义的:Spaces are significant everywhere in an Object Name. Do not write type=Thread, name=DGC (with a space after the comma) because it will be interpreted as having a key called “ name”, with a leading space in the name.
- 大小写敏感的:Object Names are case sensitive.
- properties顺序无关性:The order of key properties is not significant.
- key命名约束:The set of characters in a key is limited. It is recommended to stick to legal Java identifiers.
- value是否使用引号:The set of characters in a value is also limited. If special characters may occur, it is recommended that the value be quoted, using
ObjectName.quote
.
In a pattern, the key-property-list can have the same form as just described; or it can be a single *
; or it can be empty
(equivalent to a *
); or it can be a list followed by ,*
. These forms match Object Names that have the exact key properties given (if any) plus any arbitrary other key properties. For example, *:type=Thread,*
matches somedomain:type=Thread
and somedomain:type=Thread,name=DGC
.
JMX基本原理
JMX的基本原理,基本框架图,有没有?这个让我费了一番精力,最后发现JMX的官方specification中有最权威的插图,言简意赅、深入浅出,看来今后也要关注官网的Specification。
JMX 1.2 specification:http://jcp.org/en/jsr/detail?id=003
JMX agent的作用是什么?其与JMX有什么关系?
参考来源
闲谈
使用Java有几年了,开始的时候看Java SE API,后来看一些经典的书籍,但是一直没有沉下心来去读一下Java官网的文档,这个才是信息源,借这个机会看了一点,今后遇到问题,还是要多到官网上看看。
原文地址:https://ningg.top/intro-jmx/