使用visualvm和JMX进行远程监视 [英] Remote monitoring with visualvm and JMX

查看:331
本文介绍了使用visualvm和JMX进行远程监视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用jvisualvm(或jconsole)监视一个远程运行的Java(春季启动)应用程序.在本地运行时,我可以在jvisualvm和jconsole中看到托管bean.远程运行时,我无法连接.我尝试了几种不同的Java进程(例如使用spring xd).在SO和Google上寻找此处的答案并没有帮助.

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 jconsole. When running remotely I cannot connect. I tried it with several different java processes (e.g. with spring xd). Looking for answers here on SO and on Google did not help.

这些是我的JAVA_OPTS(在远程主机上):

These are my JAVA_OPTS (on the remote host):

$ echo $JAVA_OPTS
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.59.99

然后我按如下方式简单地启动程序(这是针对spring xd的,但是我在其他Java程序中也遇到相同的问题).

Then I simply start the program as follows (this is for spring xd, but I experience the same problem with other java programs).

$ bin/xd/xd-singlenode

服务器进程似乎选择了以下选项:

The server process seems to pick up the options:

$ ps -ef | grep single
vagrant  22938 19917 99 06:38 pts/2    00:00:03 /usr/lib/jvm/java-8- oracle/jre/bin/java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.59.99 -Dspring.application.name=admin -Dlogging.config=file:/home/vagrant/spring-xd-1.1.0.RELEASE/xd/config///xd-singlenode-logger.properties -Dxd.home=/home/vagrant/spring-xd-1.1.0.RELEASE/xd -Dspring.config.location=file:/home/vagrant/spring-xd-1.1.0.RELEASE/xd/config// -Dxd.config.home=file:/home/vagrant/spring-xd-1.1.0.RELEASE/xd/config// -Dspring.config.name=servers,application -Dxd.module.config.location=file:/home/vagrant/spring-xd-1.1.0.RELEASE/xd/config//modules/ -Dxd.module.config.name=modules -classpath (...)

远程主机(ubuntu linux vm)上的Java版本是:

The java version on the remote host (ubuntu linux vm) is:

$ 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)

本地计算机(Mac OS)上的Java版本略有不同:

The java version on the local machine (Mac OS) is slightly different:

$ 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)

在jvisualvm中,我按如下方式添加了远程连接(使用ssl连接和不使用ssl连接都进行了尝试:

In jvisualvm I add the remote connection as follows (tried both with ssl connection and without):

这是jvisualvm给我的错误消息:

This is the error message jvisualvm gives me:

当远程进程正在运行时,我可以使用命令telnet 192.168.59.99:9010从本地主机连接到远程主机,因此这似乎不是防火墙问题.

I can connect from the local host to the remote host with the command telnet 192.168.59.99:9010, when the remote process is running -- so this does not seem to be a firewall problem.

我们非常感谢您的帮助.

Any help is highly appreciated.

推荐答案

请使用以下JVM选项:

Please use the following JVM options :

-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=192.168.59.99

在Jconsole中,使用以下命令进行连接:

In the Jconsole use the following to connect:

service:jmx:rmi:///jndi/rmi://192.168.59.99:9010/jmxrmi

这篇关于使用visualvm和JMX进行远程监视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆