简体   繁体   English

访问在 HTTP 代理服务器后面运行的启用 JMX 的应用程序

[英]Access JMX enabled application running behind an HTTP proxy server

I have a JMX enabled Java application (Java 1.5) sitting behind an HTTP proxy server.我有一个启用 JMX 的 Java 应用程序 (Java 1.5) 位于 HTTP 代理服务器后面。 So I cannot access it directly through the JConsole.所以我无法通过 JConsole 直接访问它。

A solution I imagine would be to have an in-VM JMX client in my application which collects the statistics and the configuration data from the JMX server and posts it to my external server periodically over HTTP through the proxy.我想一个解决方案是在我的应用程序中有一个虚拟机内 JMX 客户端,它从 JMX 服务器收集统计信息和配置数据,并通过代理定期通过 HTTP 将其发布到我的外部服务器。 My external server replies back with any configuration changes if needed and the in-VM JMX client propagates those changes to the JMX server which applies them to the application.如果需要,我的外部服务器会回复任何配置更改,并且 VM 内 JMX 客户端会将这些更改传播到 JMX 服务器,然后将它们应用于应用程序。

I'd guess this to be a scenario frequent enough to have solutions already addressing it.我猜想这是一个足够频繁的场景,已经有解决方案解决它。 Is there any helper framework/library to enable such access over HTTP?是否有任何帮助框架/库来启用对 HTTP 的此类访问?

Not sure this is what you need, but there is a very nice JMX to REST bridge called Jolokia out there.不确定这是您需要的,但有一个非常好的 JMX 到 REST 桥,称为Jolokia If you add it to your application, you will be able to interact with JMX through REST interface that will be accessible via HTTP proxy like any other HTTP traffic.如果将其添加到应用程序中,您将能够通过 REST 接口与 JMX 交互,该接口可通过 HTTP 代理访问,就像任何其他 HTTP 流量一样。 So not only you are tunneling JMX through HTTP, but you are also exposing it in much nicer format (JSON over HTTP).因此,您不仅通过 HTTP 隧道传输 JMX,而且还以更好的格式(通过 HTTP 的 JSON)公开它。

It has pretty good documentation , also see my showcase .它有很好的文档,也可以看看我的展示

If your server is hosted on Linux/Unix, you can set up port forwarding to it(using putty, ssh or other tools).如果您的服务器托管在 Linux/Unix 上,您可以设置到它的端口转发(使用 putty、ssh 或其他工具)。 Then fire up JConsole and specify local host and port to channel requests to your remote server.然后启动 JConsole 并指定本地主机和端口以将请求引导到远程服务器。 SSH Port forwarding is pretty trivial to setup and you will find ample examples on web. SSH 端口转发的设置非常简单,您可以在 web 上找到大量示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM