zoukankan      html  css  js  c++  java
  • spring cloud微服务快速教程之(六) 应用监控 spring boot admin

    0-前言

      当我们发布了微服务后,我们希望对各个应用的各个运行状况进行一个监控;这个时候spring boot admin,就出场了;

      spring boot admin:是一个监控和管理spring boot 应用的开源监控组件, 它能够对Actuator 中的信息进行界面化的展示,也可以监控所有 Spring Boot 应用的健康状况,提供实时警报功能。

    一、集成spring boot admin

    1、创建server端:

    1.1、创建monitor模块,添加依赖:

    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server</artifactId>
    <version>2.0.5</version>
    </dependency>
    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server-ui</artifactId>
    <version>2.0.5</version>
    </dependency>

    1.2、启动类增加 @EnableAdminServer 注解

    @SpringBootApplication
    @EnableEurekaClient
    @EnableAdminServer
    public class application
    {
        public  static void main(String[] args)
        {
            SpringApplication.run(application.class);
        }
    
    }

    服务端完成

    2、客户端(需要监控的应用端):

    2.1、添加依赖:

            <!-- 集成Admimn监控-->
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-starter-client</artifactId>
                <version>2.0.5</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>

    2.2、配置文件中增加配置:

    spring:
      application:
        name: user
    
      boot:
        admin:
          client:
            url: http://localhost:8771
    
    management:
      endpoints:
        web:
          exposure:
            include: "*"

    完成

    3、运行测试

      依次启动各相关项目,打开monitor地址,可以看到,对所添加的监控项目已经进行了各种监控,很方便我们查看运行状况,内容包括:

    显示应用程序的监控状态、应用程序上下线监控、查看 JVM,线程信息、可视化的查看日志以及下载日志文件、动态切换日志级别、Http 请求信息跟踪等;可以自己去深入了解各监控项;

     

      GITdemo地址:https://github.com/anson-yang/springclouddemo

  • 相关阅读:
    haproxy frontend 和backend
    haproxy 页面重定向(域名跳转)
    LWP::Simple 模块
    Perl LWP模块
    错误代码: 1582 Incorrect parameter count in the call to native function 'str_to_date'
    perl 面向对象 -> 符号使用
    跨域访问设置
    mysql 主从复制用户权限限制
    错误代码: 1045 Access denied for user 'skyusers'@'%' (using password: YES)
    sync_relay_log
  • 原文地址:https://www.cnblogs.com/yanghj/p/12164695.html
Copyright © 2011-2022 走看看