SpringBoot Actuator可以帮助程序员监控和管理SpringBoot,比如健康检查、内存使用情况、线程使用情况统计。添加Actuator依赖,即可使用Actuator监控项目
1.
#开启所有监控端点 management.endpoints.web.exposure.include=*
2.查看路径:http://localhost:8888/actuator
http://localhost:8888/actuator/env :环境属性
http://localhost:8888/actuator/health:健康检查
http://localhost:8888/actuator/mappings:显示所有的@RequestMapping路径
http://localhost:8888/actuator/loggers:日志
http://localhost:8888/actuator/info:定制信息
http://localhost:8888/actuator/metrics:查看内存、cpu核心等系统参数
http://localhost:8888/actuator/用户请求信息
3.SpringBoot指标监控可视化工具
1.创建SpringBoot Admin项目 里面添加SpringMVC和SpringBoot Admin服务端起步依赖
2.添加配置文件数据,端口号要与被监控的项目不一样
3.在启动类上方添加@EnableAdminServer注解,开启SpringBoot Admin服务端
4.被监控项目添加SpringBoot Admin客户端起步依赖
5.修改被监控项目配置文件,添加:spring.boot.admin.client.url=http://localhost:9999