spring boot admin监控分server和client两部分
一、server端:
pom.xml文件添加
<properties>
<!--版本-->
<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
</properties>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<!--邮件告警-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<!-- Thymeleaf 模版,用于发送模版邮件。按实际情况取舍 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<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>application.properties配置
spring.application.name=myspringbootadmin
server.port=8888
spring.mail.host=smtp.xxxx.com
spring.mail.username=aaa@xxxx.com
spring.mail.password=xxxx
#spring.mail.properties.mail.smtp.auth=true
spring.boot.admin.notify.mail.enabled=true
spring.boot.admin.notify.mail.ignore-changes=UNKNOWN:UP
spring.boot.admin.notify.mail.to=bbb@xxxx.com
spring.boot.admin.notify.mail.cc=ccc@xxxx.com
spring.boot.admin.notify.mail.from=aaa@xxxx.com二、client端
pom.xml配置
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.3.1</version>
</dependency>application.properties配置
spring.boot.admin.client.url=http://127.0.0.1:8888
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
management.endpoint.httptrace.enabled=true
spring.boot.admin.client.instance.service-url=http://127.0.0.1:8081
版权声明:本文为dinghai_ok原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。