如何在Spring Boot独立应用程序中激活JMX监控 [英] How to activate JMX monitoring in spring boot standalone app

查看:0
本文介绍了如何在Spring Boot独立应用程序中激活JMX监控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了几乎所有的文档,但几乎不能抓住这个神秘的东西。 那么我的问题是我可以通过http jmx url使用我的独立的Spring Boot应用程序来监控我的应用程序的运行状况和其他指标吗?我是否需要为此配置其他内容? 我已在启动应用程序中添加了以下依赖项。

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jolokia</groupId>
        <artifactId>jolokia-core</artifactId>
    </dependency>

我还在配置文件中配置了以下属性。

management.endpoints.web.exposure.include=*
management.endpoints.jmx.unique-names=true
management.server.port=8080
management.server.ssl.enabled=false

当我尝试点击URL:http://localhost:8080/actuator/jolokia/health时,无法看到任何结果。

还尝试添加如下所示的自定义终结点,但不起作用。

@Endpoint(id="mypoint")
    @Component
    public class myPointEndPoint {
        @ReadOperation
        public String mypoint(){
            return "Hello" ;
        }

具有附加属性
Management.endpoint t.mypoint t.Enabled=True

推荐答案

问题出在您尝试调用的URL。 首先,使用http://localhost:8080/actuator/jolokia/list

检索可能的MBean

查看Health mBean时,必须提供唯一的名称和操作(Op)。

在我的例子中,它看起来像:http://localhost:8080/actuator/jolokia/exec/org.springframework.boot:type=Endpoint,name=Health,identity=4200098/health

同时查看Jolokia文档:https://jolokia.org/reference/html/index.html

这篇关于如何在Spring Boot独立应用程序中激活JMX监控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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