简体   繁体   English

使用Java visualvm和JMX进行远程监视

[英]Remote monitoring with java visualvm and JMX

I would like to monitor a remotely running java (spring boot) application with jvisualvm (or jconsole). 我想用jvisualvm(或jconsole)监视一个远程运行的Java(春季启动)应用程序。 When running locally, I can see the managed beans in both jvisualvm and jconsole. 在本地运行时,我可以在jvisualvm和jconsole中看到托管bean。 When running remotely I cannot connect. 远程运行时,我无法连接。 I tried it with several different java processes (eg with spring xd). 我尝试了几种不同的Java进程(例如,使用spring xd)。 Looking for answers here on SO and on Google did not help. 在SO和Google上寻找答案并没有帮助。

These are my JAVA_OPTS (on the remote host): 这些是我的JAVA_OPTS(在远程主机上):

$ echo $JAVA_OPTS
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=10.106.138.210

The java version on the remote host (centos linux vm) is: 远程主机(centos linux vm)上的Java版本是:

$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

The java version on the local machine (Mac OS) is slightly different: 本地计算机(Mac OS)上的Java版本略有不同:

java in windows machine Windows机器中的Java

$ java -version    
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
In jvisualvm I add the remote connection as follows (tried both with ssl connection and without):

When i connect remote java application through JVISUALVM as like, 10.106.138.210:9010 当我通过JVISUALVM连接远程Java应用程序时,就像10.106.138.210:9010

I got error like, 我有类似的错误,

Cannot connect to 10.106.138.210:9010 service:jmx:rmi:///jndi/rmi://10.106.138.210:9010/jmxrmi

Please help me 请帮我

Most likely you can't connect due to a networking problem, for example the IP address you're using is incorrect, a firewall is preventing connectivity, or the java process you're connecting to isn't actually listening on port 9010. This command should succeed remotely to indicate connectivity with TCP/IP: 很可能是由于网络问题而无法连接,例如,您使用的IP地址不正确,防火墙阻止了连接或您要连接的java进程实际上没有在端口9010上监听。命令应该可以成功远程指示与TCP / IP的连接:

telnet 10.106.138.210 9010

Reference: 参考:

https://visualvm.java.net/jmx_connections.html https://visualvm.java.net/jmx_connections.html

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

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