zoukankan      html  css  js  c++  java
  • Actuator监控器

    一、简介

    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头等)
  • 相关阅读:
    【404】int main(int argc,char * argv[]) windows 下的使用
    【403】COMP9024 Exercise
    【402】Twitter Data Collection
    【401】Python 求合数的所有质数因子
    【400】numpy.pad 为数组加垫(迷宫类题目)
    iOS开发之指纹解锁
    iOS-响应链(Responder Chain)
    iOS上手指点击波纹效果的实现
    使用methodSignatureForSelector与forwardInvocation实现消息转发 (转)
    Objective-C中的@dynamic(转)
  • 原文地址:https://www.cnblogs.com/edda/p/13261536.html
Copyright © 2011-2022 走看看