springboot添加admin监控

SpringBoot应用可以通过Actuator来暴露应用运行过程中的各项指标,Spring Boot Admin通过这些指标来监控SpringBoot应用,然后通过图形化界面呈现出来。Spring Boot Admin不仅可以监控单体应用,还可以和Spring Cloud的注册中心相结合来监控微服务应用。

Spring Boot Admin 可以提供应用的以下监控信息:

  • 监控应用运行过程中的概览信息;
  • 度量指标信息,比如JVM、Tomcat及进程信息;
  • 环境变量信息,比如系统属性、系统环境变量以及应用配置信息;
  • 查看所有创建的Bean信息;
  • 查看应用中的所有配置信息;
  • 查看应用运行日志信息;
  • 查看JVM信息;
  • 查看可以访问的Web端点;
  • 查看HTTP跟踪信息。

adminserver

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-server</artifactId>
			<version>2.3.1</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<version>2.3.2.RELEASE</version>
		</dependency>
server:
  port: 9301
spring:
  application:
    name: admin-server
@EnableAdminServer
@SpringBootApplication
public class AdminServerApp {
	public static void main(String[] args) {
		new SpringApplicationBuilder(AdminServerApp.class).web(WebApplicationType.SERVLET).run(args);
	}
}

adminclient

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-client</artifactId>
			<version>2.3.1</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<version>2.3.2.RELEASE</version>
		</dependency>
server:
  port: 9305

spring:
  application:
    name: admin-client
  boot:
    admin:
      client:
        url: http://localhost:9301

management:
  endpoints:
    web:
      exposure:
        include: '*'
  endpoint:
    health:
      show-details: always

logging:
  file: admin-client.log

启动

启动server和client
访问http://localhost:9301/,就可以看到各种监控信息

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值