SpringBoot-监视信息可视化以及邮件报警


可视化是基于actuator

服务端

添加依赖

在这里插入图片描述

添加注释

启动类添加

@SpringBootApplication
@EnableAdminServer
public class AdminApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminApplication.class, args);
    }

}

运行后

在这里插入图片描述

客户端

添加依赖

在这里插入图片描述

添加配置

# 开启所有的端点
management.endpoints.web.exposure.include=*
        
server.port=8081
#客户点连接admin
spring.boot.admin.client.url=http://localhost:8080

启动项目 admin显示如下

在这里插入图片描述

邮件报警

加入邮件依赖

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>

添加配置邮件信息

spring.mail.host=smtp.qq.com
spring.mail.port=587
spring.mail.username=
spring.mail.password=
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.debug=true

spring.boot.admin.notify.mail.to=
spring.boot.admin.notify.mail.from=
# 所有情况都不忽略 都需要发邮件
spring.boot.admin.notify.mail.ignore-changes=

重启测试结果
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_39232166/article/details/106109933