zoukankan      html  css  js  c++  java
  • springcloud-整合 Spring Boot Actuator

    • 指标监控是什么?
    • 为微服务集成 Spring Boot Actuator
    • 基础指标监控的端点

      Spring Boot Actuator 是 Spring Boot 管方提供的监控组件。我们只需要在项目中添加该依赖就可以整合 Spring Boot Actuator

    端点(Spring Boot 2.x)描述HTTP 方法是否敏感端点(Spring Boot 1.x)
    conditions 显示自动配置的信息 GET autoconfig
    beans 显示应用程序上下文所有的 Spring bean GET beans
    configprops 显示所有 @ConfigurationProperties 的配置属性列表 GET configprops
    dump 显示线程活动的快照 GET dump
    env 显示环境变量,包括系统环境变量以及应用环境变量 GET env
    health 显示应用程序的健康指标,值由 HealthIndicator 的实现类提供;结果有 UP、 DOWN、OUT_OF_SERVICE、UNKNOWN;如需查看详情,需配置:management.endpoint.health.show-details GET health
    info 显示应用的信息,可使用 info.* 属性自定义 info 端点公开的数据 GET info
    mappings 显示所有的 URL 路径 GET mappings
    metrics 显示应用的度量标准信息

    添加依赖

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

    运行

    mvn spring-boot:run

    C:Usersljavademomicroservice-provider-user>curl http://localhost:8000/actuator/health
    {"status":"UP"}

    配置文件

    management:
      endpoint:
        health:
          # 是否展示健康检查详情
          show-details: always
    
    mvn spring-boot:run

    sersljavademomicroservice-provider-user>curl http://localhost:8000/actuator/health {"status":"UP","components":{"db":{"status":"UP","details":{"database":"H2","validationQuery":"isValid()"}},"diskSpace":{"status":"UP","details":{"total":127357939712,"free":29238120 448,"threshold":10485760,"exists":true}},"ping":{"status":"UP"}}}

     

    如果想暴露所有监控点

    management:
    endpoints:
    web:
    exposure:
    include: '*'

    health:
    # 是否展示健康检查详情
    show-details: always


    C:Usersljavademomicroservice-provider-user>curl http://localhost:8000/actuator/health
    {"status":"UP"}

      

    菜鸟的自白
  • 相关阅读:
    PAT 1088. Rational Arithmetic
    PAT 1087. All Roads Lead to Rome
    PAT 1086. Tree Traversals Again
    PAT 1085. Perfect Sequence
    PAT 1084. Broken Keyboard
    PAT 1083. List Grades
    PAT 1082. Read Number in Chinese
    求最大公因数
    [转载]Latex文件转成pdf后的字体嵌入问题的解决
    [转载]Matlab有用的小工具小技巧
  • 原文地址:https://www.cnblogs.com/lzjloveit/p/14415421.html
Copyright © 2011-2022 走看看