Spring Boot集成 Spring Boot Admin 监控

这篇文章主要介绍了Spring Boot集成 Spring Boot Admin 监控,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

【前言】

程序开发完实现相应的功能只是一个部分,如何让系统在线上运行更好创造更高的价值是另外一个部分;监控是一个生产级项目避不可少重要组成部分;最近研究一下针对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.zhanghanzh-parent1.0.0-SNAPSHOTcom.zhanghanzh-monitor1.0.0-SNAPSHOTzh-monitorzhanghan monitor for Spring Boot  org.springframework.bootspring-boot-starter-web de.codecentricspring-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.codecentricspring-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的特性。

以上就是Spring Boot集成 Spring Boot Admin 监控的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » Java