服务监控Spring Boot Actuator

(1)添加依赖

我使用的springboot的版本是2.0.5.RELEASE版本

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

(2)可以直接使用的请求

路径作用
/autoconfig获取应用的自动化配置报告
/beans获取应用上下文创建的所有bean
/configprops获取应用中配置的属性信息报告
/env用来获取应用所有可用的环境属性报告。包括环境变量、JVM属性、应用的配置属性和命令行中的参数。
/mappings返回所有Spring MVC的控制器映射关系报告。
/info返回应用自定义的信息
/metrics用来返回当前应用的各类重要度量指标,比如内存信息、线程信息、垃圾收集信息等。
/health获取应用的各类健康指标信息。
/dump暴露程序运行中的线程信息。
/trace返回基本的HTTP跟踪信息。
/shutdown关闭应用,通过endpoints.shutdown.enabled=true进行设置。

(3)出现问题

如果在访问上述端点的时候出现以下问题:

Full authentication is required to access actuator endpoints. Consider adding Spring Security or set 'management.security.enabled' to false.

解决方案:在application.properties文件中设置:

endpoints.actuator.enabled=true
endpoints.actuator.sensitive=false
endpoints.beans.sensitive=false
endpoints.beans.enabled=true
endpoints.health.sensitive=false
endpoints.health.enabled=true
#安全验证
management.security.enabled=false
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值