Spring Boot2.x 之actuator
Actuator监控和度量Spring Boot 应用程序;
- 增加maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
- 默认端点
Spring Boot 2.0 的Actuator只暴露了health和info端点,提供的监控信息无法满足我们的需求
- 开启所有的端点;在配置文件增加
management.endpoints.web.exposure.include=*
-
获取api的列表
http://{ip}:{port}/actuator
-
相关的api的介绍:
health:
显示系统状态{“status”:“UP”}
shutdown:
用来关闭节点;需要手动开启远程关闭的功能: management.endpoint.shutdown.enabled=true
使用post请求端点
metrics
返回应用的各类重要度量指标信息
Metrics节点并没有返回全量信息,我们可以通过不同的key去加载我们想要的值
metrics/jvm.memory.max
info
获取应用自定义的信息
threaddump
1.x中为dump
返回程序运行中的线程信息
env
获取应用所有可用的环境属性报告
configprops
获取应用中配置的属性信息报告