我有一个Spring引导项目,在这里我使用spring启动器-驱动器和io.dropwizard.metrics。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
</dependency>它生成我可以使用url http://myapplication/metrics访问的度量。我将应用程序部署在Wildfly 10独立服务器上。
我想使用jmx来读取j控制台上的指标。我将应用程序配置为使用JMXReporter发送度量:
@Configuration
@EnableMetrics
public class MetricsConfiguration extends MetricsConfigurerAdapter {
@Override
public void configureReporters(MetricRegistry metricRegistry) {
registerReporter(JmxReporter.forRegistry(metricRegistry)
.build())
.start();
}
}当我启动服务器并部署应用程序时,日志显示:
o.s.b.a.e.j.EndpointMBeanExporter定位了托管bean“metricsEndpoint”:将JMX服务器注册为MBean门户-ws-jmx:type=Endpoint,name=metricsEndpoint

当我运行j控制台时,在本地进程列表中,只有jconsole进程和一些灰色PID。如果我选择一个灰色PID,上面写着“管理代理在这个过程中不能启用”。
我还尝试使用远程进程连接:

但这不管用。
我试图设置jvm变量:
以及财产:
也不起作用。
我能用j控制台读取jmx指标吗?
发布于 2016-07-11 13:16:27
我在这里找到了一个解决方案:https://dzone.com/articles/remote-jmx-access-wildfly-or
我的问题来自野蝇。当我运行j控制台时,我需要jboss-cli-client.jar和tools.jar来运行jconsole类路径:
$JAVA_HOME/bin/jconsole -J-Djava.class.path=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/jconsole.jar:/opt/wildfly-8.2.0.Final/bin/client/jboss-cli-client.jar现在,我可以使用"service:jmx:remote+http://localhost:9990“连接到jmx。
发布于 2016-07-08 13:45:41
下面是我使用的一组命令行参数,用于生成一个可以工作的spring引导应用程序(尽管使用的是Tomcat,而不是Wildfly),它通过JConsole公开了一些内容:
cmd="$cmd -Dcom.sun.management.jmxremote"
cmd="$cmd -Dcom.sun.management.jmxremote.port=9899"
cmd="$cmd -Dcom.sun.management.jmxremote.rmi.port=9811"
cmd="$cmd -Dcom.sun.management.jmxremote.authenticate=false"
cmd="$cmd -Dcom.sun.management.jmxremote.ssl=false"
cmd="${cmd} -Djava.rmi.server.hostname=<IP_OF_YOUR_SERVER>"请注意,应用程序运行并通过端口9800进行访问(在我的例子中)。但是,端口9811和9899也可用于处理JMX (如前所述)。您还需要确保通过设置的任何防火墙都可以访问这3个端口。
祝好运
https://stackoverflow.com/questions/38267980
复制相似问题