使用spring boot admin监视应用服务器状态

1.官方文档:springbootadmin
2.码云地址:springbootadmin码云
3.新建springboot应用
startspring地址:startspring
4.添加pom
admin版本注意事项,如果springboot版本为2.1.x版本,则admin也选择2.1.x版本,很多admin服务报错都是由于版本不兼容导致的
admin主服务添加:

<properties>
        <spring-boot-admin.version>2.1.6</spring-boot-admin.version>
    </properties>
	<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
     </dependency>
	 <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
被监视的springboot应用添加:
<properties>
        <spring-boot-admin.version>2.1.6</spring-boot-admin.version>
    </properties>
	<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>
	 <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

5.添加服务启动注解
spring boot admin启动类添加

@Configuration
@EnableAdminServer

如果为spring cloud 应该,则将admin注册到注册中心即可,如果未注册到注册中心,则需要每个被监测应用配置spring boot admin 服务url
在这里插入图片描述
注意:如果spring boot admin注册到了注册中心,且被监测应用又做了如上的配置,则spring监测面板将出现两个同样的被监测服务。
6.添加配置文件
所有被监视应用yml文件添加如下配置

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

7.集成阿里钉钉群提醒

钉钉群提醒参考博客:
springbootadmin钉钉群提醒

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值