3

我浏览了几乎所有的文档,但都无法掌握这些神秘的东西。所以我的问题 -我可以使用我的独立 Spring Boot 应用程序通过 http jmx url 监控我的应用程序的运行状况和其他指标吗?我需要为此配置其他东西吗?我在启动应用程序中添加了以下依赖项。

    <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.mypoint.enabled=true

4

1 回答 1

3

问题是您尝试调用的 url。首先,使用以下命令检索可能的 mbean:http://localhost:8080/actuator/jolokia/list

当您查看 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

于 2018-09-24T19:16:45.560 回答