SpringBoot Admin 2.1.5监控微服务的基本配置

1. 介绍

SpringBoot Admin可以看作是Spring actuator监控的一个UI界面,可以很方便的查看服务的运行情况。本篇文章只做一个简单的基本配置介绍。

1.1 admin server配置

基于eureka,将admin server注册到服务注册中心,则其他微服务不要任何改动即可被监控(前提是是暴露了监控端点)。
加入依赖

	
        org.springframework.cloud
        spring-cloud-starter-netflix-eureka-client
    
    
        de.codecentric
        spring-boot-admin-starter-server
    
    
        org.springframework.boot
        spring-boot-starter-actuator
    
    
        org.springframework.boot
        spring-boot-starter-web
    
    
        org.springframework.boot
        spring-boot-starter-security
    

注解AdminServer

@EnableAdminServer

application.yml配置

	spring:
	  application:
	    name: your app name
	  profiles:
	    active: dev
	  security:
	    user:
	      name: "admin"
	      password: "admin"
	management:
	  endpoints:
	    web:
	      exposure:
	        include: "*"
	  endpoint:
	    health:
	      show-details: always

**需要注意的是:**由于默认的management端点未完全开放,所以可能最后展示出的信息不全,这里使用management.endpoints.web.exposure.include="*"方式暴露所有监控端点,以便查看更详细的信息。

2. 启动admin server

首先启动eureka server,然后依次启动admin server以及各个微服务:
SpringBoot Admin 2.1.5监控微服务的基本配置_第1张图片
然后访问:http://localhost:9000

SpringBoot Admin 2.1.5监控微服务的基本配置_第2张图片

点击具体的服务即可查看监控信息:

SpringBoot Admin 2.1.5监控微服务的基本配置_第3张图片

SpringBoot Admin 2.1.5监控微服务的基本配置_第4张图片

你可能感兴趣的:(SpringCloud)