可昕之家

可昕之家

张先生

平淡如水,爱护家人,好好工作

34 文章数
0 评论数

SpringbootAdmin监控微服务

张清磊
2025-03-16 / 0 评论 / 36 阅读 / 0 点赞

上一章节讲述了ingress怎么配置的问题,并且结合spritngbootadmin案例讲解。

跳转:/article/k8szmbzingressdhttpszshspringbootzsyz(springboot-adminlz

但是关于springboot-admin-server怎么监控微服务,没有更细讲解。现在做案例补充

本文主要针对springboot3进行说明,以yudao-cloud-jdk17为案例,springboot2和3区别不大。

先说引包如下

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>3.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
        <!-- Nacos 服务发现 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
        </dependency>
    </dependencies>

配置文件

20250316ff6c99643e6f426ca12939fc853dd54f.png

如果不想监控自身,可以增加

20250316b158e4d89ff0497da2c4e003a806b117.png

需要注意的是,因为有验证,需要被监控的服务增加如下

202503169f6fa5cea2ea4ef8b6398d783f7140ae.png

这样再看界面就可以了

202503160d620758bc6f4b01873ecc4408a8bb0a.png

如果你使用看K8S并且使用ingress访问admin,可以参考下,里面有一些关于K8S访问的介绍

https://zhangqinglei.cn/article/k8szmbzingressdhttpszshspringbootzsyz(springboot-adminlz)

上一篇 下一篇
评论
最新回复
    暂无内容
光阴似箭
今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月
文章目录
今日天气