赞
踩
https://github.com/983674707/AdminUi
什么是监控中心(针对微服务服务的监控):
1.服务器内存变化(堆内存 线程 日志管理等),
2.检测服务器配置连接地址是否可用(模拟访问,懒加载),
3.统计多个bean(是spring容器的bean),
4.统计springMVC @RequestMapping(统计http接口)。
Actuator监控应用(没有界面,返回json格式)
AdminUi 底层使用了Actuator监控应用 ,实现可视化界面
应用场景:生产环境
pom.xml
1 2 3 4 5 6 7 8 | <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> |
application.yml
1 2 3 4 5 6 | ##通过下面的配置启动所有夫人监控端点,默认情况下,这下端点是禁用的 management: endpoints: web: exposure: include: "*" |
如果不加这段配置
##默认情况下,监控中心提供三个接口权限。
在SpringBoot2.0之后, 监控中心的接口地址发生变化:
2.0:http://localhost:2018/actuator/beans
1.5:http://localhost:2018/beans
pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.5.RELEASE</version> ##必须是2.0以上 <relativePath/> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.0.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.jolokia</groupId> <artifactId>jolokia-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> |
启动类
@EnableAdminServer
application.yml
1 2 3 4 5 | server: port: 2001 spring: application: name: AdminUi-Server |
pom.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.5.RELEASE</version> <relativePath/> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId>##与server不同的地方 <version>2.0.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webflux</artifactId> </dependency> <dependency> <groupId>org.jolokia</groupId> <artifactId>jolokia-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> |
启动类
1 2 3 4 5 6 7 | @SpringBootApplication ##只有这一个注解 public class AdminuiClientApplication {
public static void main(String[] args) { SpringApplication.run(AdminuiClientApplication.class, args); } } |
application.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ##表明server地址 spring: boot: admin: client: url: http://localhost:2001 ##端口 server: port: 2002 ##Actuator监控的权限(全开*) management: endpoints: web: exposure: include: "*" |
AdminUi
AdminUi
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。