SpringBoot实战(十二):集成 Spring Boot Admin 监控

程序开发完实现相应的功能只是一个部分,如何让系统在线上运行更好创造更高的价值是另外一个部分;监控是一个生产级项目避不可少重要组成部分;最近研究一下针对SpringBoot的监控项目---Spring Boot Admin,并集成项目中,在此与大家共享;

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:
https://zhanghan.blog.csdn.net/article/details/101273915

【前言】

程序开发完实现相应的功能只是一个部分,如何让系统在线上运行更好创造更高的价值是另外一个部分;监控是一个生产级项目避不可少重要组成部分;最近研究一下针对SpringBoot的监控项目—Spring Boot Admin,并集成项目中,在此与大家共享;

【SpringBootAdmin】

         一、SpringBootAdmin简介
1、github地址:https://github.com/codecentric/spring-boot-admin
2、重要功能列表:

         二、项目中集成SpringBootAdmin
1、搭建SpringBootAdmin服务端
(1)新建springboot项目(在此项目名定为zh-monitor)
(2)pom文件如下:



    4.0.0

    
        com.zhanghan
        zh-parent
        1.0.0-SNAPSHOT
    

    com.zhanghan
    zh-monitor
    1.0.0-SNAPSHOT
    zh-monitor
    zhanghan monitor for Spring Boot

    

        
            org.springframework.boot
            spring-boot-starter-web
        

        
            de.codecentric
            spring-boot-admin-starter-server
        


    


    
        zh-monitor
    



(3)启动类如下(ZhMonitorApplication):

/*
 * Copyright (c) 2019. zhanghan_java@163.com All Rights Reserved.
 * 项目名称:实战SpringBoot
 * 类名称:ZhMonitorApplication.java
 * 创建人:张晗
 * 联系方式:zhanghan_java@163.com
 * 开源地址: https://github.com/dangnianchuntian/springboot
 * 博客地址: https://zhanghan.blog.csdn.net
 */

package com.zhanghan.zhmonitor;

import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableAdminServer
public class ZhMonitorApplication {

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

}

(4)配置文件如下(application.properties):

server.port=8091
spring.application.name=zhMonitor

2、SpringBoot项目集成SpringBootAdmin客户端
(1)Pom中增加相关依赖



    de.codecentric
    spring-boot-admin-client

(2)启动配置文件中增加连接服务端地址

         三、部分功能效果展示:
1、详细指标

2、Log日志级别管理

3、JVM线程

4、Web中http展示

         四、项目地址:
1、地址:https://github.com/dangnianchuntian/springboot
2、代码版本:1.5.0-Release

【总结】

1、工欲善其事必先利其器,监控为系统保驾护航,让系统运行的更加稳定,发挥更大的业务价值;
2、接下来会为大家共享更多关于SpringBootAdmin的特性。

Posted by zhanghan

6年Java互联网研发经验,坐标北京;擅长微服务和中间件。

1 comment

发表评论