spring-boot-starter-actuator监控接口详解
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类
- 应用配置类
/configprops /autoconfig /beans /env /info /mappings
- 度量指标类
/dump /health
- 操作控制类
下面找几个来解释
/autoconfig
自动化配置报告,可以看出一些自动化配置为什么没有生效

/beans
可以看到定义的所有的bean

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

/env

/mappings

/info
返回application.properties文件中info开头的配置信息,如:
# /info端点信息配置
info.app.name=spring-boot-hello
info.app.version=v1.0.0

下面是度量指标类
/metrics

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

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

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


/dump
调用 java.lang.management.ThreadMXBean的
public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers); 方法来返回活动线程的信息


操作控制类
如:/shutdown ,通过在application.properties文件中添加
endpoints.shutdown.enabled=true
来开启

貌似上面命令直接把应用关了......
</div>
</div>
spring-boot-starter-actuator监控接口详解的更多相关文章
- Spring Boot Actuator监控使用详解
在企业级应用中,学习了如何进行SpringBoot应用的功能开发,以及如何写单元测试.集成测试等还是不够的.在实际的软件开发中还需要:应用程序的监控和管理.SpringBoot的Actuator模块实 ...
- Spring Boot的每个模块包详解
Spring Boot的每个模块包详解,具体如下: 1.spring-boot-starter 这是Spring Boot的核心启动器,包含了自动配置.日志和YAML. 2.spring-boot-s ...
- Spring Boot源码中模块详解
Spring Boot源码中模块详解 一.源码 spring boot2.1版本源码地址:https://github.com/spring-projects/spring-boot/tree/2.1 ...
- spring boot 配置文件properties和YAML详解
spring boot 配置文件properties和YAML详解 properties中配置信息并获取值. 1:在application.properties配置文件中添加: 根据提示创建直接创建. ...
- Spring Boot 配置加载顺序详解
使用 Spring Boot 会涉及到各种各样的配置,如开发.测试.线上就至少 3 套配置信息了.Spring Boot 可以轻松的帮助我们使用相同的代码就能使开发.测试.线上环境使用不同的配置. 在 ...
- Spring Boot Logback几种日志详解
日志对于应用程序来说是非常重要的,Spring框架本身集成了不少其他工具,我们自身的应用也会使用到第三方库,所以我们推荐在Spring应用中使用SLF4J/Logback来记录日志. SLF4J与Lo ...
- spring boot(四):thymeleaf使用详解
在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thymeleaf的使用.thymeleaf 是新一代的模板引擎,在spring4. ...
- Spring Boot 2.0 教程 - 配置详解
Spring Boot 可以通过properties文件,YAML文件,环境变量和命令行参数进行配置.属性值可以通过,@Value注解,Environment或者ConfigurationProper ...
- Spring Boot(四):Thymeleaf 使用详解
在上篇文章Spring Boot (二):Web 综合开发中简单介绍了一下 Thymeleaf,这篇文章将更加全面详细的介绍 Thymeleaf 的使用.Thymeleaf 是新一代的模板引擎,在 S ...
- (转)Spring Boot(四):Thymeleaf 使用详解
http://www.ityouknow.com/springboot/2016/05/01/spring-boot-thymeleaf.html 在上篇文章Spring Boot (二):Web 综 ...
随机推荐
- CentOS-6.5安装配置Tomcat-7
https://my.oschina.net/u/593517/blog/304483 http://blog.csdn.net/lgh0824/article/details/51194116 摘要 ...
- ubuntu下7z文件的解压方法
apt-get install p7zip-full 控制台会打出以下信息: 正在读取软件包列表... 完成正在分析软件包的依赖关系树 正在读取状态信息... 完成 建议安装的 ...
- Linux:命令gedit
首先,gedit是一个GNOME桌面环境下兼容UTF-8的文本编辑器.它使用GTK+编写而成,因此它十分的简单易用,有良好的语法高亮,对中文支持很好,支持包括gb2312.gbk在内的多种字符编码. ...
- P2532 [AHOI2012]树屋阶梯 卡特兰数
这个题是一个卡特兰数的裸题,为什么呢?因为可以通过划分来导出递推式从而判断是卡特兰数,然后直接上公式就行了.卡特兰数的公式见链接. https://www.luogu.org/problemnew/s ...
- (Go)06. Printf格式化输出、Scanf格式化输入详解
Print.Println .Printf .Sprintf .Fprintf都是fmt 包中的公共方法,在需要打印信息时需要用到这些函数,那么这些函数有什么区别呢? Print: 输出到控制台(不接 ...
- 洛谷P1077 摆花(背包dp)
P1077 摆花 题目描述 小明的花店新开张,为了吸引顾客,他想在花店的门口摆上一排花,共m盆.通过调查顾客的喜好,小明列出了顾客最喜欢的n种花,从1到n标号.为了在门口展出更多种花,规定第i种花不能 ...
- .net core 下Web API 技术栈
API文档工具:swagger https://www.cnblogs.com/suxinlcq/p/6757556.html https://www.cnblogs.com/danvic712/p/ ...
- Django之ORM的增删改查操作流程
总结:ORM的 查.增.删.改 - 查 - client - 有一个展示页面(xxx_show.html) - 这一个页面一输入执行后,get请求向server端发送 - 这个展示页面有添加按钮.删除 ...
- A - Diverse Team
Problem description There are n students in a school class, the rating of the i-th student on Codeho ...
- android平台 cocos2d-x 读取相册数据
现已解决 方案如下: 1.使用 jni 调用 java 方法 启动相册选择框2.使用java将获取的图片保存到本地3.使用Cocos2d-x中 CCImage 读取 JAVA代码如下: //启动图片选 ...