springboot2.0 Actuator监控

依赖

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

Endpoints配置

actuator有很多端点,springboot2.0默认为 /actuator,可以配置根节点

management.endpoints.web.base-path=/

渲染出来的路径为

部分端点意义

端点 描述
/metrics 应用程序度量信息,比如内存用量和HTTP请求计数
/metrics/{name} 指定名称的应用程序度量值(name为/metrics查询出的名字)
/health 应用程序的健康指标
/info 应用程序的定制信息

暴露所有端点

#开启全部端点
management.endpoints.web.exposure.include=*

开启health端点

management.endpoints.jmx.exposure.include=health

跨域配置

management.endpoints.web.cors.allowed-origins=http://ip地址 
management.endpoints.web.cors.allowed-methods=*
management.endpoints.web.cors.allow-credentials=true

本人认为这篇博客不错https://blog.csdn.net/u012326462/article/details/80596051

猜你喜欢

转载自blog.csdn.net/z_victoria123/article/details/85634483