Is there any JMX - REST bridge available?

前端 未结 5 1399
慢半拍i
慢半拍i 2020-12-31 02:32

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 inter

相关标签:
5条回答
  • 2020-12-31 02:48

    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.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-31 02:52

    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

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-31 03:12

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

    0 讨论(0)
提交回复
热议问题