首页 > 其他 > 详细

Actuator监控器

时间:2020-07-07 17:09:26      阅读:51      评论:0      收藏:0      [点我收藏+]

一、简介

Actuator(激励者;执行器)是Spring Boot提供的一个可挺拔模块,用于对工程进行监控。其通过不同的监控终端实现不同的监控功能。其功能与Dubbo的监控中心类似,不同的是,Dubbo的监控中心是需要专门部署的,而Spring Boot的Actuator是存在于每一个工程中的。

二、依赖

随便一个Spring Boot工程中都可以使用Actuator对其进行监控。

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-actuator</artifactId>
  4. </dependency>

三、配置

  1. #-----------------------------------Actuator监控器------------------------------------
  2. # Actuator监控端口与控制中心,默认只开启info、与health监控
  3. # http://localhost:9999/actuator/beans
  4. management:
  5. server:
  6. port: 9999 #设置Actuator监控端口
  7. endpoints:
  8. web:
  9. exposure:
  10. include: ‘*‘ #打开Actuator所有监控
  11. #exclude: [‘env‘,‘beans‘]
  12. base-path: /actuator #设置Actuator监控基本路径
  13. #-----------------------------------INFO------------------------------------
  14. #自定义INFO信息
  15. #浏览器访问 http://localhost:9999/actuator/info
  16. info:
  17. company:
  18. name: ‘公司名称‘
  19. url: ‘www.xxxx‘
  20. addr: ‘china‘

四、访问测试

1、beans终端

http://localhost:9999/actuator/beans

技术分享图片

2、env

http://localhost:9999/actuator/env

技术分享图片

3、自定义信息

技术分享图片

 

五、常用的监控终端

在百度搜索“springboot actuator”即可找到如下表格

HTTP 方法 监控终端 功能描述
GET /autoconfig 提供了一份自动配置报告,记录哪些自动配置条件通过了,哪些没通过
GET /configprops 描述配置属性(包含默认值)如何注入Bean
GET /beans 描述应用程序上下文里全部的Bean,以及它们的关系
GET /dump 获取线程活动的快照
GET /env 获取全部环境属性
GET /env/{name} 根据名称获取特定的环境属性值
GET /health 报告应用程序的健康指标,这些值由HealthIndicator的实现类提供
GET /info 获取应用程序的定制信息,这些信息由info打头的属性提供
GET /mappings 描述全部的URI路径,以及它们和控制器(包含Actuator端点)的映射关系
GET /metrics 报告各种应用程序度量信息,比如内存用量和HTTP请求计数
GET /metrics/{name} 报告指定名称的应用程序度量值
POST /shutdown 关闭应用程序,要求endpoints.shutdown.enabled设置为true
GET /trace 提供基本的HTTP请求跟踪信息(时间戳、HTTP头等)

Actuator监控器

原文:https://www.cnblogs.com/edda/p/13261536.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!