基于SpringBoot 实现指标监控及日志管理

SpringBoot与Actuator监控及SpringBootAdmin可视化:集成与日志管理

添加Actuator功能

Spring Boot Actuator可以帮助程序员监控和管理SpringBoot应用,比如健康检查、内存使用情况统计、线程使用情况统计等。我们在SpringBoot项目中添加Actuator功能,即可使用Actuator监控

项目,用法如下:

在被监控的项目中添加Actuator起步依赖

org.springframework.boot spring-boot-starter-actuator

在配置文件中开启所有监控端点
#开启所有监控端点
management.endpoints.web.exposure.include=*

测试:
访问项目:http://localhost:8080/actuator

图片

可以看到有很多json格式的字符串,这些都是该路径下的相关资源信息,并且通过URL可以调用actuator的功能:
图片

例如查询日志信息数据,访问localhost:8080/actuator/loggers

图片

SpringBoot指标监控 Spring Boot Admin

Actuator使用JSON格式展示了大量指标数据,不利于我们查看,我们可以使用可视化工具Spring Boot Admin查看actuator生成指标数据。Spring Boot Admin是一个独立的项目,我们需要创建并运
行该项目。

  1. 创建Spring Boot Admin服务端项目

创建SpringBoot项目,添加SpringMVC和Spring Boot Admin服务端起步依赖


org.springframework.boot
spring-boot-starter-web


de.codecentric
spring-boot-admin-start

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值