Spring Boot Admin 2.0开箱体验

Profile


概述

在我之前的 《Spring Boot应用监控实战》 一文中,讲述了如何利用 Spring Boot Admin 1.5.X 版本来可视化地监控 Spring Boot 应用。说时迟,那时快,现在 Spring Boot Admin 都更新到 2.0 版本了,并且可以对当下热门的 Spring Boot 2.0Spring Cloud Finchley.RELEASE 进行监控,因此本文就来了解并实践一下!

注: 本文首发于 My 公众号 CodeSheep ,可 长按扫描 下面的 小心心 来订阅 ↓ ↓ ↓

CodeSheep · 程序羊



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 工程并添加依赖

    1<dependencies> 2 <dependency> 3 <groupId>de.codecentric</groupId> 4 <artifactId>spring-boot-admin-starter-server</artifactId> 5 <version>2.0.1</version> 6 </dependency> 7 8 <dependency> 9 <groupId>de.codecentric</groupId> 10 <artifactId>spring-boot-admin-server-ui</artifactId> 11 <version>2.0.1</version> 12 </dependency> 13 14 <dependency> 15 <groupId>org.springframework.boot</groupId> 16 <artifactId>spring-boot-starter-web</artifactId> 17 </dependency> 18</dependencies>
  • 应用主类添加注解

    @SpringBootApplication @EnableAdminServer public class SbaServer20Application {

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

    }

  • 启动 Spring Boot Admin Server

浏览器打开 localhost:8080,就可以看到小清新的页面了

小清新的页面

可以看到这个 UI 的变化和 1.5.X 时代的差距还是蛮大的,此时被监控的应用数目还为0。

接下来我们就来创建一个待监控的Spring Boot 2.0示例。



创建 Spring Boot Admin Client

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

  • pom.xml中添加依赖

    1<dependencies> 2 <dependency> 3 <groupId>de.codecentric</groupId> 4 <artifactId>spring-boot-admin-starter-client</artifactId> 5 <version>2.0.1</version> 6 </dependency> 7 8 <dependency> 9 <groupId>org.springframework.boot</groupId> 10 <artifactId>spring-boot-starter-actuator</artifactId> 11 </dependency> 12 13 <dependency> 14 <groupId>org.springframework.boot</groupId> 15 <artifactId>spring-boot-starter-web</artifactId> 16 </dependency> 17</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 有点小清新

Wallboard

  • Applications 概览

Applications概览

  • Applications上线日志一目了然

Applications上线日志一目了然

  • Applications Details

Applications Details

  • Metrics

Metrics

  • Environment

Environment

  • JMX

JMX

  • Threads

Threads

  • Http Traces

Http Traces



后记

作者更多的SpringBt实践文章在此:


如果有兴趣,也可以抽点时间看看作者一些关于容器化、微服务化方面的文章:



点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )