Remote monitoring with visualvm and JMX

后端 未结 3 1691
太阳男子
太阳男子 2021-01-30 14:20

I would like to monitor a remotely running java (spring boot) application with jvisualvm (or jconsole). When running locally, I can see the managed beans in both jvisualvm and

3条回答
  •  囚心锁ツ
    2021-01-30 15:17

    Arnab Biswas's anwser not work in my case. After an hour of researching, I found out that JMX runs on top of RMI, and as such, there are 2 ports that JMX utilizes:

    • The JMX connect port. (-Dcom.sun.management.jmxremote.port)
    • The (infamously) roaming RMI data port. (-Dcom.sun.management.jmxremote.rmi.port)

    RMI data port will open a random port start from 1099. By setting the port used by the RMI registry and the RMI server to the same port, tunneling will be much easier.

    So I need to add -Dcom.sun.management.jmxremote.rmi.port=9010 to JVM options

    And I need to use the following JVM options :

    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9010 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.59.99
    

    Read more:

    • http://hirt.se/blog/?p=289
    • https://realjenius.com/2012/11/21/java7-jmx-tunneling-freedom/
    • https://medium.com/codefountain/monitoring-using-java-visualvm-a25203d36390

提交回复
热议问题