spring-boot-starter-actuator 是什么

一句话,actuator是监控系统健康情况的工具。

- 怎么用?

1. 添加 POM依赖

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

2. 启动的时候就会有下面这些提示.

Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.uti
Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.ser
Mapped URL path [/webjars/**] onto handler of type [class org.springframework.we
Mapped URL path [/**] onto handler of type [class org.springframework.web.servle
Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframewor
Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto p
Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}"
Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" ont
Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application
Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/j
Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto
Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto
Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]
Mapped "{[/health || /health.json],produces=[application/json]}" onto public jav
Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" ont
Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto publi
Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto pu

- actuator 的端点分为3类

  1. 应用配置类

/configprops /autoconfig /beans /env /info /mappings

  1. 度量指标类

/dump /health

  1. 操作控制类
  • 下面找几个来解释

    • /autoconfig

自动化配置报告,可以看出一些自动化配置为什么没有生效

image.png
  • /beans

可以看到定义的所有的bean

image.png
  • /configprops

可以看到application.properties里面的信息

image.png
  • /env
image.png
  • /mappings
image.png
  • /info

返回application.properties文件中info开头的配置信息,如:

# /info端点信息配置
info.app.name=spring-boot-hello
info.app.version=v1.0.0
image.png

下面是度量指标类

  • /metrics
image.png

我们也可以自定实现 CounterService 接口来实现count指标.

image.png

也可以用 [/metrics/{name:.*}] 如: /metrics/mem.free 来获取单个指标信息

image.png
  • /health

可以通过实现 HealthIndicator 接口来实现健康检查,返回值的状态信息在org.springframework.boot.actuate.health.Status

image.png
image.png
  • /dump

调用 java.lang.management.ThreadMXBean

public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers); 方法来返回活动线程的信息

image.png
image.png
  • 操作控制类

如:/shutdown ,通过在application.properties文件中添加

endpoints.shutdown.enabled=true

来开启

image.png

貌似上面命令直接把应用关了......

      </div>
</div>
posted @
2019-05-09 16:51 
星朝 
阅读(...) 
评论(...) 
编辑 
收藏

spring-boot-starter-actuator监控接口详解的更多相关文章

  1. Spring Boot Actuator监控使用详解

    在企业级应用中,学习了如何进行SpringBoot应用的功能开发,以及如何写单元测试.集成测试等还是不够的.在实际的软件开发中还需要:应用程序的监控和管理.SpringBoot的Actuator模块实 ...

  2. Spring Boot的每个模块包详解

    Spring Boot的每个模块包详解,具体如下: 1.spring-boot-starter 这是Spring Boot的核心启动器,包含了自动配置.日志和YAML. 2.spring-boot-s ...

  3. Spring Boot源码中模块详解

    Spring Boot源码中模块详解 一.源码 spring boot2.1版本源码地址:https://github.com/spring-projects/spring-boot/tree/2.1 ...

  4. spring boot 配置文件properties和YAML详解

    spring boot 配置文件properties和YAML详解 properties中配置信息并获取值. 1:在application.properties配置文件中添加: 根据提示创建直接创建. ...

  5. Spring Boot 配置加载顺序详解

    使用 Spring Boot 会涉及到各种各样的配置,如开发.测试.线上就至少 3 套配置信息了.Spring Boot 可以轻松的帮助我们使用相同的代码就能使开发.测试.线上环境使用不同的配置. 在 ...

  6. Spring Boot Logback几种日志详解

    日志对于应用程序来说是非常重要的,Spring框架本身集成了不少其他工具,我们自身的应用也会使用到第三方库,所以我们推荐在Spring应用中使用SLF4J/Logback来记录日志. SLF4J与Lo ...

  7. spring boot(四):thymeleaf使用详解

    在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thymeleaf的使用.thymeleaf 是新一代的模板引擎,在spring4. ...

  8. Spring Boot 2.0 教程 - 配置详解

    Spring Boot 可以通过properties文件,YAML文件,环境变量和命令行参数进行配置.属性值可以通过,@Value注解,Environment或者ConfigurationProper ...

  9. Spring Boot(四):Thymeleaf 使用详解

    在上篇文章Spring Boot (二):Web 综合开发中简单介绍了一下 Thymeleaf,这篇文章将更加全面详细的介绍 Thymeleaf 的使用.Thymeleaf 是新一代的模板引擎,在 S ...

  10. (转)Spring Boot(四):Thymeleaf 使用详解

    http://www.ityouknow.com/springboot/2016/05/01/spring-boot-thymeleaf.html 在上篇文章Spring Boot (二):Web 综 ...

随机推荐

  1. caioj1495: [视频]基于连通性状态压缩的 动态规划问题:Formula 2

    本来想写一天插头的,但是这题太难受(绝望)500+的代码量..我选择下午放松一下. 先ORZ一下苏大佬(yz的cdq啊%%%%%)居然把cdq论文里面的题抠出来出数据放在c站(呵呵真是个悲伤的故事不过 ...

  2. Expression Trees (C# and Visual Basic)

    https://msdn.microsoft.com/en-us/library/bb397951.aspx Expression trees represent code in a tree-lik ...

  3. TCP打开文件传输(客户端code)

    #include <stdio.h>#include <stdlib.h>#include <arpa/inet.h>#include <sys/types. ...

  4. [JavaEE] JBoss主要版本下载链接一览

    URL: http://teddysun.com/260.html JBoss在2006年被 RedHat 收购.在各种 J2EE 应用服务器中,JBoss 是最受欢迎而且功能最为强大的应用服务器.不 ...

  5. 浅谈自学Python之路(day1)

    2018-02-19  17:15:14 Python语言相对于其他语言较为简洁,也相对好入门比如后面不加分号,基本见不着大括号等优点 第一个程序,也是学每门语言都需要掌握的第一个代码 print(& ...

  6. RabbltMQ

    协议:AMQP协议  支持事务 端口号:默认端口5672 1.简单队列(simple queue) 一个生产者对应一个消费者 2.工作队列(work queue) 一个生产者对应多个消费者: 轮询分发 ...

  7. 企业级分布式监控系统--zabbix

    目录 1.Zabbix简介 2.zabbix安装 3.工作原理 4.监控功能 5.监控系统架构 6.Zabbix系统架构 7.Zabbix组件构成 8.zabbix监控环境中基本概念 正文 回到顶部 ...

  8. php中curl的详细解说 【转载】

    这几天在帮一些同学处理问题的时候,突然发现这些同学是使用file_get_contents()函数来采集页面内容的,貌似都没有curl的概念亦或是对这种工具特别不敏感, 本文我来给大家详细介绍下cUR ...

  9. 移动端弹性滑动以及vue记录滑动位置

    -webkit-overflow-scrolling介绍 -webkit-overflow-scrolling: auto | touch; auto: 普通滚动,当手指从触摸屏上移开,滚动立即停止 ...

  10. 如何写出高性能SQL语句(文章摘自web开发者)

    (声明:本文内容摘自web开发者,仅供收藏学习之用,如有侵权请作者联系博主,博主将在第一时间删除) 原文地址:http://www.admin10000.com/document/484.html 1 ...