使用Spring Boot Actuator 监控程序运行状态

2.X版本Spring Boot Actuator的使用

1、maven依赖

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

2、application.yml配置

server:
  port: 8762
management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS
对于几个配置的说明:
management:
  endpoints:
    enabled-by-default: false # 禁用所有端点
management:
  endpoints:
    web:
      exposure:
        exclude: env # 禁用运行环境信息

3、访问 http://127.0.0.1:8762/actuator ,可以看到Actuator 端点列表

{"_links":{"self":{"href":"http://localhost:8762/actuator","templated":false},"archaius":{"href":"http://localhost:8762/actuator/archaius","templated":false},"auditevents":{"href":"http://localhost:8762/actuator/auditevents","templated":false},"beans":{"href":"http://localhost:8762/actuator/beans","templated":false},"caches-cache":{"href":"http://localhost:8762/actuator/caches/{cache}","templated":true},"caches":{"href":"http://localhost:8762/actuator/caches","templated":false},"health":{"href":"http://localhost:8762/actuator/health","templated":false},"health-component":{"href":"http://localhost:8762/actuator/health/{component}","templated":true},"health-component-instance":{"href":"http://localhost:8762/actuator/health/{component}/{instance}","templated":true},"conditions":{"href":"http://localhost:8762/actuator/conditions","templated":false},"shutdown":{"href":"http://localhost:8762/actuator/shutdown","templated":false},"configprops":{"href":"http://localhost:8762/actuator/configprops","templated":false},"env":{"href":"http://localhost:8762/actuator/env","templated":false},"env-toMatch":{"href":"http://localhost:8762/actuator/env/{toMatch}","templated":true},"info":{"href":"http://localhost:8762/actuator/info","templated":false},"loggers":{"href":"http://localhost:8762/actuator/loggers","templated":false},"loggers-name":{"href":"http://localhost:8762/actuator/loggers/{name}","templated":true},"heapdump":{"href":"http://localhost:8762/actuator/heapdump","templated":false},"threaddump":{"href":"http://localhost:8762/actuator/threaddump","templated":false},"metrics":{"href":"http://localhost:8762/actuator/metrics","templated":false},"metrics-requiredMetricName":{"href":"http://localhost:8762/actuator/metrics/{requiredMetricName}","templated":true},"scheduledtasks":{"href":"http://localhost:8762/actuator/scheduledtasks","templated":false},"httptrace":{"href":"http://localhost:8762/actuator/httptrace","templated":false},"mappings":{"href":"http://localhost:8762/actuator/mappings","templated":false},"refresh":{"href":"http://localhost:8762/actuator/refresh","templated":false},"restart":{"href":"http://localhost:8762/actuator/restart","templated":false},"pause":{"href":"http://localhost:8762/actuator/pause","templated":false},"resume":{"href":"http://localhost:8762/actuator/resume","templated":false},"features":{"href":"http://localhost:8762/actuator/features","templated":false},"service-registry":{"href":"http://localhost:8762/actuator/service-registry","templated":false},"jolokia":{"href":"http://localhost:8762/actuator/jolokia","templated":false}}}

4、对几个端点的说明

beans,应用中beans的关系列表

health,健康指标

env,环境变量

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值