Spring Boot admin

Spring Boot 极大的简化了我们的开发,他也提供了对于Spring Boot 应用的监控 ,Spring Boot Actuator可以帮助你监控和管理Spring Boot应用,比如健康检查、审计、统计和HTTP追踪等。所有的这些特性可以通过JMX或者HTTP endpoints来获得,但是它反馈给我们的信息是这样的

{
   "status":"UP",
   "details":{
      "db":{
         "status":"UP",
         "details":{
            "database":"MySQL",
            "hello":1
         }
      },
      "diskSpace":{
         "status":"UP",
         "details":{
            "total":250790436864,
            "free":100330897408,
            "threshold":10485760
         }
      }
   }
}

等等… 这样我们从直观上感觉不是太好理解,下面这个将是帮助我们去观察的图形化界面: Spring Boot Admin

Spring Boot Admin 用于监控基于 Spring Boot 的应用,它是在 Spring Boot Actuator 的基础上提供简洁的可视化 WEB UI。
Spring Boot Admin 提供了很多功能,如显示 name、id 和 version,显示在线状态,Loggers 的日志级别管理,Threads 线程管理,Environment 管理等。

Spring Boot admin 是有客户端服务端组成的

先看看服务端:

pom:


        
            org.springframework.boot
            spring-boot-starter-web
        
        
            de.codecentric
            spring-boot-admin-starter-server
            2.1.0
        
     

启动类:

@SpringBootApplication
@EnableAdminServer
public class AdminApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminApplication.class, args);
    }
  }

配置文件:

server.port=8000

这时启动项目,请求localhost:8000 就会看到
Spring Boot admin_第1张图片

然后在看看客户端:

pom:

  
        
            de.codecentric
            spring-boot-admin-starter-client
            2.0.0
        

配置文件:

spring
  boot:
    admin:
      client:
        url: "http://localhost:8000"

management:
  endpoints:
    web:
      exposure:
        include: "*"

启动被监控的应用:(客户端)
Spring Boot admin_第2张图片

这样就可以了,
Spring Boot admin_第3张图片

注: 如果你的应用程序中有Redis 的话,请启动它,不然会显示异常

你可能感兴趣的:(springBoot,只要相信才能造飞机)