Is there any JMX - REST bridge available?

前端 未结 5 1401
慢半拍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: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

提交回复
热议问题