Springboot之监控中心Actuatorhttps://blog.csdn.net/kxj19980524/article/details/86760119

它的原理就是把各个服务端的actuator的json数据发送给adminui来统一管理

adminui-server服务端搭建

创建服务端项目导入依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.buba</groupId>
    <artifactId>adminui</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>adminui</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.0.0</version><!--1.5.7-->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jolokis</groupId>
            <artifactId>jolokis-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Springboot使用AdminUi可视化监控中心Springboot使用AdminUi可视化监控中心

启动然后访问localhost:8080就出现下面是界面了

Springboot使用AdminUi可视化监控中心

adminui-client客户端搭建

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.buba</groupId>
    <artifactId>adminui-client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>adminui-client</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.0.0</version><!--1.5.7-->
        </dependency>
        <dependency>
            <groupId>org.jolokis</groupId>
            <artifactId>jolokis-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
#配置注册到adminui-server端平台
spring.boot.admin.client.url=http://localhost:8080

server.port=8081

#开放所有权限
management.endpoints.web.exposure.include="*"

然后先启动服务端,再启动客户端,就可以查看一些详细信息.这个客户端可以配置多个.

Springboot使用AdminUi可视化监控中心

Springboot使用AdminUi可视化监控中心

相关文章:

  • 2021-11-04
  • 2022-01-13
  • 2022-12-23
  • 2021-04-20
  • 2021-09-14
  • 2021-11-16
  • 2021-11-04
猜你喜欢
  • 2021-11-04
  • 2021-11-11
  • 2021-07-01
  • 2021-09-23
  • 2021-06-02
  • 2021-05-25
  • 2021-06-03
相关资源
相似解决方案