接上一篇:SpringBoot入门到精通_第4篇 _开发三板斧
https://blog.csdn.net/weixin_40816738/article/details/101097161

文章目录

  • 一、 SpringBoot Actuator 概念
    • 1. 是什么?
    • 2. 如何整合SpringBoot Actuator?
  • 二、 SpringBoot Actuator 实战
    • 2.1. 监控导航端点
    • 2.2. 默认端点
    • 2.3. 常用端点一览表:
      • 2.3.1 健康检查端点:
      • 2.3.2 应用描述端点:
      • 2.3.2 激活所有的端点
      • 2.3.3 配置属性端点
      • 2.3.4 度量指标端点
      • 2.3.5 查看jvm的内存端点
      • 2.3.5 查看jvm的线程状态端点
      • 2.3.6 根据需求激活某个端点

一、 SpringBoot Actuator 概念

1. 是什么?

  • SpringBoot Actuator是SpringBoot 里面非常重要的一个组件,他为我们的应用提供了强大的监控能力。
    现在的应用越来越复杂了,线上往往需要借助一些监控工具,快速的定位问题。

2. 如何整合SpringBoot Actuator?

  • 第一步:添加依赖
<!--监控-->
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
  • 第二步:启动类加注解(暂时不需要)
  • 第三步:写配置(暂时不需要)

到此,整合SpringBoot Actuator完成了!!!

二、 SpringBoot Actuator 实战





pom.xml依赖

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

application.yml

#actuator监控
#  暴露原则
#  never :不暴露
#  always :暴露
management:endpoint:health:show-details: always

2.1. 监控导航端点

浏览器访问
SpringBoot的导航端点:http://localhost:8080/actuator

2.2. 默认端点

  • 默认端点暴露health和info端点

2.3. 常用端点一览表:

端点(SpringBoot2.x对照) 描述 http方法 端点(SpringBoot1.x对照)
conditions 显示自动配置信息 GET autoconfig
beans 显示应用程序上下文所有的Springbean GET beans
configprops 显示@ConfigurationProperties的配置属性列表 GET configprops
threaddump 显示县城活动的快照 GET dump
env 显示环境变量,包括系统环境变量以及应用环境变量 GET env
health 显示应用程序的健康指标,值由HealthIndicator的实现类提供;结果有UP、DOWNOUT_OF_SERVICE、UNKOWN; 如需查看详情,需要配置management.endpoint.health. show-details GET health
heapdump 堆dump GET heapdump
info 小时应用的信息,可食用info.*属性自定义info端点公开的数据 GET info
loggers GET:显示日志级别 POST:动态修改日志级别 GET/POST loggers
mappings 显示所有URL的路径 GET mappings
metrics 显示应用度量指标信息 GET metrics

2.3.1 健康检查端点:

http://localhost:8080/actuator/health

# /health
#  作用:健康检查
# status 取值:
#UP:正常
#DOWN:遇到问题,不正常
#OUT_OF_SERVICE:资源未在使用,或者不该去使用
#UNKNOWN: 不知道

2.3.2 应用描述端点:

http://localhost:8080/actuator/info

2.3.2 激活所有的端点

#激活导航端点actuator下面的所有的端点

#actuator监控
#  暴露原则
#  never :不暴露
#  always :暴露
#激活所有的actuator端点
management:endpoints:web:exposure:include: "*"endpoint:health:show-details: always#描述应用 端点info key value形式
info.app-name: springboot-actuator
info.author: gblfy
info.email: gblfy@email.com

2.3.3 配置属性端点

/actuator/configprops端点:
表示:应用当前的配置属性
应用场景:在项目中配置了某个属性,可以通过此端点查看配置是否生效
http://localhost:8080/actuator/configprops

2.3.4 度量指标端点

http://localhost:8080/actuator/metrics
具体查看,在后面拼接即可

2.3.5 查看jvm的内存端点

http://localhost:8080/actuator/metrics/jvm.memory.max

2.3.5 查看jvm的线程状态端点

http://localhost:8080/actuator/metrics/jvm.threads.states

2.3.6 根据需求激活某个端点

比如说想激活/actuator/health和/actuator/metrics端点,该怎么做?

management:endpoints:web:exposure:include: health,metricsendpoint:health:show-details: always

下一篇:
SpringBoot入门到精通_第6篇 _必知必会
https://blog.csdn.net/weixin_40816738/article/details/101100029

SpringBoot入门到精通_第5篇 _SpringBoot Actuator监控相关推荐

  1. SpringBoot入门到精通_第6篇 _必知必会

    接上一篇:SpringBoot入门到精通_第5篇 _SpringBoot Actuator监控 https://blog.csdn.net/weixin_40816738/article/detail ...

  2. SpringBoot入门到精通_第4篇 _开发三板斧

    接上一篇:SpringBoot入门到精通_第3篇 _应用组件分析 https://blog.csdn.net/weixin_40816738/article/details/101096218 文章目 ...

  3. SpringBoot入门到精通_第3篇 _应用组件分析

    接上一篇:SpringBoot入门到精通_第2篇 _1分钟实战需求项目 https://blog.csdn.net/weixin_40816738/article/details/101095964 ...

  4. SpringBoot入门到精通_第2篇 _1分钟实战需求项目

    接上一篇:SpringBoot入门到精通_第1篇 _核心概念 https://blog.csdn.net/weixin_40816738/article/details/94916051 文章目录 一 ...

  5. SpringBoot入门到精通_第7篇 _必知必会总结

    接上一篇:SpringBoot入门到精通_第6篇 _必知必会

  6. SpringBoot入门到精通_第1篇 _核心概念

    SpringBoot 必知必会 核心精粹 文章目录 一.SpringBoot必知必会 1. 是什么?能做什么? 2. 有哪些特性? 一.SpringBoot必知必会 1. 是什么?能做什么? 是什么? ...

  7. MyBatis-Plus 从入门到精通,这一篇就够了【推荐收藏】

    MyBatis-Plus 从入门到精通,这一篇就够了[推荐收藏] mybatis-plus是一款Mybatis增强工具,用于简化开发,提高效率.下文使用缩写mp来简化表示mybatis-plus,本文 ...

  8. SpringBoot入门到精通-SpringBoot启动流程(七)

    定义自己的starter SpringBoot入门到精通-Spring的注解编程(一) SpringBoot入门到精通-SpringBoot入门(二) SpringBoot入门到精通-Spring的基 ...

  9. MySQL数据库,从入门到精通:第七篇——MySQL单行函数应用

    MySQL数据库,从入门到精通:第七篇--MySQL单行函数应用 第七篇_单行函数 1. 函数的理解 1.1 什么是函数 1.2 不同DBMS函数的差异 2. 数值函数 2.1 基本函数 2.3 三角 ...

最新文章

  1. 思科光传输功率查询_各品牌网络设备的光功率查看方法(不完全统计)
  2. 一个好的软件开发人员的标准
  3. android audiotrack权限,Android中AudioRecord和AudioTrack的使用注意
  4. 怎样在javascript中直接设置好打印方式为横向或纵向(測試未果)
  5. linux standby模式,搭建11g 单机 linux standby 操作文档
  6. UE4像素流送(Pixel Streaming)快速上手指南
  7. 聊聊如何对员工做绩效考核
  8. 创新产业发展战略:大前研一
  9. html单元格边框斜线,excel表头三斜线 将线条的两端放在单元格的边框上
  10. IT桔子文飞翔:人工智能行业发展趋势
  11. 为什么都说Dubbo不适合传输大文件?Dubbo支持的协议
  12. ts-学习类型-class
  13. 菱形继承中构造函数调用问题
  14. 北京十大推动中国科技发展的人工智能实验室
  15. spotlight on linux 安装及配置
  16. 唐骏离职新华都当老板
  17. 程序设计c语言高速公路收费标准,C语言 高速公路超速处罚
  18. 机器人ccid认证_机器人认证来了
  19. 计算机安全英语作文,关于校园安全的英语作文4篇
  20. 用Python构建和可视化决策树

热门文章

  1. Python除了不会生孩子,什么都会
  2. 单向链表 双向链表 java代码实现
  3. 多线程笔记补充之线程通信wait和notify方法以及Lock和Condition接口的使用
  4. 【计算几何】线段相交
  5. 【机器学习】AI系统实时监测独居老人症状
  6. 使用CLONE TABLE方式实现同region不同可用区的MaxCompute
  7. 上去很美的 Serverless 在中国落地的怎么样了?
  8. 如果测试没有梦想,那跟咸鱼有什么区别?
  9. 这些数据科学家必备的技能,你拥有哪些?
  10. “融合、智能、绿色”施耐德电气线上工博以全生命周期解决方案助推数字化