zoukankan      html  css  js  c++  java
  • Spring Cloud微服务实战 打造企业级优惠券系统 3-11 SpringBoot-Actuator监控(原生端点)

    0    课程地址

    https://coding.imooc.com/lesson/380.html#mid=28362

    1    浓缩精华
    1.1  浓缩精华

    3.2,4.1

    2    个人关注
    2.1  个人关注

    4.1

    3    课程内容
    3.1  如何开启Actuator监控

    a  引入相关依赖

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

    b  application.yml配置文件开启监控功能

    spring:
     # profiles:
     #  active: prod
     #注意:这里不能有profiles active: dev,否则 按application-dev配置文件的端口号
     #   active: dev
      application:
        name: imooc_springboot_study
    
    server:
    #端口号
      port: 8081
      servlet:
        context-path: /imooc
    
    com:
      imooc:
        userid: 110
        username: aaa
    
    management:
      endpoint:
        shutdown:
          enabled: true #  最特殊的监控端点,开通后可以通过shutdown url对程序进行关闭动作。一般不会开启
      endpoints:
        web:
          exposure:
            include: "*"  #  打开所有端点
    
    #127.0.0.1:8081/imooc/actuator/
    
    info:
      app:
        name: imooc_springboot_study
        groupid: org.springframework.boot
        version: 2.1.4.RELEASE
    3.2  原生端点三类监控

    ◆应用配置类常用监控
    自己配置的info 信息:/actuator/info
    应用中bean的信息:/actuator/beans
    应用中URI路径信息:/actuator/mappings

    ◆度量指标类常用监控
    检查应用的运行状态:/actuator/health
    A当前线程活动快照:/actuator/threaddump

    ◆操作控制类常用监控
    关闭应用(POST):/actuator/shutdown
    curl-XPOST"http://localhost:8080/actuator/shutdown

    3.3  其他内容

    4    代码演练
    4.1  代码演练

    a  引入相关依赖

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

    b  application.yml配置文件开启监控功能

    spring:
     # profiles:
     #  active: prod
     #注意:这里不能有profiles active: dev,否则 按application-dev配置文件的端口号
     #   active: dev
      application:
        name: imooc_springboot_study
    
    server:
    #端口号
      port: 8081
      servlet:
        context-path: /imooc
    
    com:
      imooc:
        userid: 110
        username: aaa
    
    management:
      endpoint:
        shutdown:
          enabled: true #  最特殊的监控端点,开通后可以通过shutdown url对程序进行关闭动作。一般不会开启
      endpoints:
        web:
          exposure:
            include: "*"  #  打开所有端点
    
    #127.0.0.1:8081/imooc/actuator/
    
    info:
      app:
        name: imooc_springboot_study
        groupid: org.springframework.boot
        version: 2.1.4.RELEASE

    访问监控信息

     

    诸葛
  • 相关阅读:
    Linux系统配置静态ip
    爬虫之如何找js入口(一)
    asyncio动态添加任务
    关于python导包问题
    python动态添加属性
    requests模块
    反selenium关键字
    PIL模块
    openxlsx模块
    CSV
  • 原文地址:https://www.cnblogs.com/1446358788-qq/p/14296104.html
Copyright © 2011-2022 走看看