SpringBoot学习(二十二)之使用监控管理

Spring Boot Admin 2.0新特性
Spring Boot Admin 2.0 变化还是挺多的,具体参考 官网说明,这里列几条主要的:
使用Vue.js重写了UI界面,漂亮得不像实力派
直接集成了基于 spring security 的认证,无需引入第三方模块
加入 session endpoint 的监控支持
等等…
下面就实际试验来操作感受一下!

搭建 Spring Boot Admin Server
创建一个 SpringBoot 2.0.3 RELEASE 工程并添加依赖

<dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.0.1</version>
        </dependency>

        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-server-ui</artifactId>
            <version>2.0.1</version>
        </dependency>

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

应用主类添加注解

@SpringBootApplication
@EnableAdminServer
public class SbaServer20Application {

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

启动 Spring Boot Admin Server
浏览器打开 localhost:8080,就可以看到小清新的页面了
file
可以看到这个 UI 的变化和 1.5.X 时代的差距还是蛮大的,此时被监控的应用数目还为0。
接下来我们就来创建一个待监控的Spring Boot 2.0示例。

创建 Spring Boot Admin Client
此处我们依然创建一个 Spring Boot 2.0.3.RELEASE 的应用,然后加入到Spring Boot Admin之中进行监控
pom.xml中添加依赖

 <dependencies>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.0.1</version>
        </dependency>

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

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

编辑配置文件

server.port=8081
spring.application.name=Spring Boot Client
spring.boot.admin.client.url=http://localhost:8080
management.endpoints.web.exposure.include=*

启动 Spring Boot Admin Client 应用
此时 Spring Boot Admin的页面上应用上线的消息推送过来了:
在这里插入图片描述
实际实验
被监控应用上线之后,我们进入 Spring Boot Admin页面鼓捣看看
Wallboard 有点小清新
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QO0TTVuJ-1574927838167)(http://note.youdao.com/yws/res/5202/WEBRESOURCEa4a2fc267f7339c032ce2099b2680622)]
Applications 概览
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OBokkj1m-1574927838168)(http://note.youdao.com/yws/res/5205/WEBRESOURCE35ed513f8c6299e89ce7d02047bd08d9)]
Metrics
file
Environment
file
JMX
file
Threads
file
Http Traces
file

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值