
Jolokia 是一种以全新方式远程访问 JMX MBean 的方案。它与 JSR-160 连接器不同,采用基于代理(agent)的方法,通过 HTTP 上的 JSON 以 REST 风格进行通信。
针对不同环境提供了多种代理:
代理方法具有以下几个优势:
对防火墙友好
由于所有通信都基于 HTTP,通过防火墙进行代理基本上不再是问题(与 RMI 通信相比,RMI 是 JSR-160 的默认模式)
多语言支持
客户端无需安装 Java。例如,Jmx4Perl 提供了丰富的 Perl 客户端库和基于 Perl 的工具来访问这些代理。
设置简单
只需简单地部署代理即可完成设置。相比之下,通过 JSR-160 导出 JMX 可能相当复杂(关于为原生远程 JMX 暴露设置 Weblogic 和 JBoss,请参阅这些博客文章)
此外,这些代理还提供了 JSR-160 连接器所不具备的额外功能:
批量请求
与 JSR-160 远程处理不同,Jolokia 可以通过一次往返处理多个 JMX 请求。单个 HTTP POST 请求将这些请求放入其 JSON 载荷中,并在代理端进行分发。这些批量请求可以大幅提升性能,尤其适用于监控解决方案。Nagios 插件 check_jmx4perl 就使用批量请求来实现其多检查功能。
细粒度安全
除了标准的 HTTP 安全机制(SSL、HTTP 认证)之外,Jolokia 还支持自定义策略,可根据多种属性进行细粒度限制,例如客户端的 IP 地址或子网,以及 MBean 名称、属性和操作。该策略以 XML 格式定义,支持允许/拒绝区域和通配符。
代理模式
Jolokia 可以在无代理模式下运行,此时对目标平台的唯一要求是其 MBeanServer 的标准 JSR-160 导出。代理在前端通过 JSON/HTTP 监听 Jolokia 请求,并通过远程 JSR-160 JMX 调用将这些请求传播到目标服务器。批量请求会在代理上透明地分发为多个 JSR-160 请求。
关于 Jolokia 的更多信息,请访问 www.jolokia.org,其中包括完整的参考手册。
我们非常欢迎以拉取请求(pull request)形式做出的贡献。您所有的作品同样必须在 Apache 公共许可证下捐赠。在提交拉取请求之前,请先签署(sign-off)您的作品。签署就是在补丁描述末尾添加一行简单的文字,证明您编写了该补丁,或者您有权将其作为开源补丁传递。规则非常简单:如果您能够证明以下内容(来自 developercertificate.org):
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
然后,您只需在每个 git 提交消息中添加一行:
Signed-off-by: Max Morlock <[email protected]>
请使用您的真实姓名(抱歉,不接受化名或匿名贡献)。
如果您设置了 user.name 和 user.email git 配置,则可以使用 git commit -s 自动签署提交。
如果您修复的是文档(错别字、格式等),则无需签署。如果您第一次忘记签署,也可以事后补签,参见这里。