博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用Admin监控
阅读量:7071 次
发布时间:2019-06-28

本文共 4104 字,大约阅读时间需要 13 分钟。

在springboot中,也提供了很全面的监控系统。这篇文章介绍一下springboot—admin监控springboot项目。

原来大致是这样的,springboot——admin——server负责当监控中心,功能类似springcloud--eureka。其他springboot作为client把自身信息注册到admin--server中去。

创建一个springboot-admin-server项目。pom文件中加入依赖,pom文件完整代码如下:

4.0.0
com.dalaoyang
springboot_admin_server
0.0.1-SNAPSHOT
jar
springboot_admin_server
springboot_admin_server
org.springframework.boot
spring-boot-starter-parent
1.5.9.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
de.codecentric
spring-boot-admin-server
1.5.6
de.codecentric
spring-boot-admin-server-ui
1.5.6
org.springframework.boot
spring-boot-maven-plugin

在springboot启动类上加入注解@EnableAdminServer,代码如下:

package com.dalaoyang;import de.codecentric.boot.admin.config.EnableAdminServer;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@EnableAdminServerpublic class SpringbootAdminServerApplication {    public static void main(String[] args) {        SpringApplication.run(SpringbootAdminServerApplication.class, args);    }}

到这里就配置完成了,启动项目访问可以看到下图,目前还没有发现client

9953332-c3b7154018513f5d
image

然后创建一个springboot-admin-client项目,pom文件如下:

4.0.0
com.dalaoyang
springboot_admin_client
0.0.1-SNAPSHOT
jar
springboot_admin_client
springboot_admin_client
org.springframework.boot
spring-boot-starter-parent
1.5.9.RELEASE
UTF-8
UTF-8
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
de.codecentric
spring-boot-admin-starter-client
1.5.6
org.springframework.boot
spring-boot-maven-plugin

然后只需配置一下服务注册到admin-server即可,配置如下:

##将服务注册到admin-serverspring.boot.admin.url=http://localhost:8080##端口号server.port=8388#禁用安全控制management.security.enabled=false

启动项目,在访问发现服务已经注册成功了,如下图

9953332-51903d66ab4466cd
image

然后点击右侧的Details,可以看到更详细的监控信息

9953332-c9c0adf026d914e6
image

Details:

9953332-023e432c46e78104
image

Metrices:

9953332-9c13d7d579a4ea9a
image

Enviroment:

9953332-2c7ff6fed79094ea
image

Logging:

9953332-f3d2d1190ef5e92d
image

JMX:

9953332-692ffd02883912e7
image

Threads:

9953332-b4bd08dd618d16c7
image

Audit:

9953332-6958a2f29bbbe05c
image

Trace:

9953332-b8ac96ffc2c51e93
image

源码下载 :

个人网站:

转载地址:http://ucell.baihongyu.com/

你可能感兴趣的文章
Struts2自己定义拦截器实例—登陆权限验证
查看>>
调用webservice查询手机号码归属地信息
查看>>
RESTFul basic introduction
查看>>
NoSQL数据库的分布式模型
查看>>
Win7下同时使用有线和无线时的优先级设置
查看>>
Python文件遍历二种方法
查看>>
GUN 的汇编语法
查看>>
java.lang.VerifyError: Inconsistent stackmap frames at branch target
查看>>
sqlite 判断表中是否包含 某个字段
查看>>
freemarker序列的拆分
查看>>
angularjs基本执行流程
查看>>
线段树 + 区间更新: HDU 4893 Wow! Such Sequence!
查看>>
再探vim经常使用命令
查看>>
[BZOJ 1066][SCOI2007]蜥蜴
查看>>
platform_device与platform_driver
查看>>
sql中update,alter,modify,delete,drop的区别和使用(整理)(转)
查看>>
Enabling Active Directory Authentication for VMWare Server running on Linux《转载》
查看>>
MySql性能优化相关
查看>>
Android学习笔记——Intents 和 Intent Filters(二)
查看>>
收藏的Android很好用的组件或者框架。
查看>>