有可用的 JMX - REST 桥吗?

发布于 2024-08-08 07:31:33 字数 281 浏览 3 评论 0原文

您好,我想使用浏览器监视 Java 应用程序,但同时利用现有的 JMX 基础设施。

我知道 JMX 提供了一个 HTTP 接口,但我认为它提供了一个标准的 Web gui,并且不可能将其功能与现有系统混搭。

您知道 JMX 的 REST 接口吗?

我目前对 Google 的研究表明,有一个项目可以做一些事情相似的。这是唯一的选择吗?

Hi I would like to monitor a Java application using the browser but at the same time utilising the existing JMX infrastructure.

I know that JMX provides a HTTP interface but I think it provides a standard web gui and its not possible to mashup its functionality with an existing system.

Are you aware of any REST interface for JMX?

My research on google currently shows that there is one project which does something similar. Is this the only option?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

倚栏听风 2024-08-15 07:31:33

Jolokia 是一个新的(目前)JMX 代理,您可以安装在 JVM 中,并通过 HTTP 公开 MBeanServer JSON 格式。

Jolokia is a new (at this time) JMX Agent you can install in your JVM and exposes the MBeanServer over HTTP in JSON format.

薄暮涼年 2024-08-15 07:31:33

Tomcat 提供了 JMX 代理 Servlet 在其管理器应用程序中。我不认为它完全是 REST,但它是无状态的,并且是由简单的 HTTP 请求构建的,所以它应该足够接近。

Tomcat provides a JMX Proxy Servlet in its Manager Application. I don't think it's exactly REST, but it's stateless and is built from simple HTTP requests, so it should be close enough.

溇涏 2024-08-15 07:31:33

为了后代,我最近在我的 SimpleJMX 包中添加了一个小型 Web 服务器。如果在类路径中,它将通过 Jetty 将 bean 从平台 MBeanServer 公开到 HTTP。所有页面还有文本版本,方便抓取。

// create a new JMX server listening on a specific port
JmxServer jmxServer = new JmxServer(8000);
jmxServer.start();

// register any beans to jmx as necessary
jmxServer.register(someObj);

// create a web server publisher listening on a specific port
JmxWebServer jmxWebServer = new JmxWebServer(8080);
jmxWebServer.start();

有一个小测试程序显示了它的运行情况。这是从浏览器访问的 java.lang:type=Memory 的图像。正如您所看到的,输出是非常基本的 HTML。

在此处输入图像描述

For posterity, I've recently added a little web server to my SimpleJMX package. It exposes beans from the platform MBeanServer to HTTP via Jetty if in the classpath. There is also text versions of all pages that make it easy to scrape.

// create a new JMX server listening on a specific port
JmxServer jmxServer = new JmxServer(8000);
jmxServer.start();

// register any beans to jmx as necessary
jmxServer.register(someObj);

// create a web server publisher listening on a specific port
JmxWebServer jmxWebServer = new JmxWebServer(8080);
jmxWebServer.start();

There's a little test program which shows it in operation. Here's an image of java.lang:type=Memory accessed from a browser. As you can see the output is very basic HTML.

enter image description here

没有你我更好 2024-08-15 07:31:33

您可能想看看 jmx4perl。它附带一个代理 servlet,它将 REST 请求代理到本地 JMX 调用,并返回包含答案的 JSON 结构。它支持读取、写入、执行、列表(mbean 列表)和搜索操作,并且知道如何通过类似 XPath 的表达式深入研究复杂的数据结构。查看协议描述以获取更多详细信息。

即将发布的版本还可以处理批量(==一次多个)请求,并增加了发布 JSON 请求作为纯 REST GET 请求的替代方案的可能性。

在下一个版本中,将支持代理模式,以便不需要在目标平台上部署代理 servlet,而只需在中间代理服务器上部署。

You might want to have a look at jmx4perl. It comes with an agent servlet which proxies REST request to local JMX calls and returns a JSON structure with the answers. It supports read, write, exec, list (list of mbeans) and search operations and knows how to dive into complex data structures via an XPath like expression. Look at the protocol description for more details.

The forthcoming release can deal with bulk (== multiple at once) requests as well and adds the possibility to post a JSON request as alternative to a pure REST GET-request.

In one of the next releases there will support a proxy mode so that no agent servlet needs to be deployed on the target platform, but only on an intermediate, proxy server.

友欢 2024-08-15 07:31:33

MX4J 是另一种选择。下面引用其主页 -

MX4J 是一个项目,旨在构建 Java(TM) 管理扩展 (JMX) 和 JMX 远程 API (JSR 160) 规范的开源实现,并构建与 JMX 相关的工具。

MX4J is another alternative., quoting below from the it's home page -

MX4J is a project to build an Open Source implementation of the Java(TM) Management Extensions (JMX) and of the JMX Remote API (JSR 160) specifications, and to build tools relating to JMX.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文