Can jconsole data be retrieved from the command line?

前端 未结 9 2087
耶瑟儿~
耶瑟儿~ 2020-12-05 17:21

I am currently using jconsole to monitor performance metrics of my Java application and would like to script this data acquisition

相关标签:
9条回答
  • 2020-12-05 18:01

    This is a partial answer to your question:

    set JAVA_OPTS=%JAVA_OPTS% -Xloggc:logs\gc.log -XX:+PrintGCDetails -XX:MaxPermSize=128m 
    
    0 讨论(0)
  • 2020-12-05 18:11

    jconsole just provides a wrapper around the JMX MBeans that are in the platform MBeanServer.

    You can write a program to connect to your VM using the Attach API which would then query the MBeans.

    Or you can expose the platform MBeanServer over RMI and query the MBeans that way.

    See the java.lang.management package for more info

    0 讨论(0)
  • 2020-12-05 18:13

    I have successfully used the tomcat jmxproxy for access from scripts ( http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Using_the_JMX_Proxy_Servlet ).

    I haven't used any of them but one of the jmx-rest projects might be an option for a non-tomcat server ( http://www.google.com/search?q=jmx+rest ).

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