springboot Actuator的指标监控可视化功能详解

SpringBoot Actuator是springboot为简化我们对微服务项目的监控功能抽取出来的模块,使得我们每个微服务快速引用即可获得生产界别的应用监控、审计等功能。这篇文章主要介绍了springboot Actuator的指标监控可视化,需要的朋友可以参考下

springboot为我们提供了丰富的指标监控功能SpringBoot Actuator

SpringBoot Actuator是springboot为简化我们对微服务项目的监控功能抽取出来的模块,使得我们每个微服务快速引用即可获得生产界别的应用监控、审计等功能。

后序文章会更新使用 我们先来看看怎么可视化

我们可以通过github上的开源项目

这里

在这里插入图片描述

我们创建一个springboot项目 作为可视化的服务端

在这里插入图片描述

使用新功能首先都是引入依赖

需要web项目

  de.codecentricspring-boot-admin-starter-server2.4.3 org.springframework.bootspring-boot-starter-web

开启我们的监控服务 @EnableAdminServer

 /** * @EnableAdminServer * 开启监控功能 */ @EnableAdminServer @SpringBootApplication public class BootAdminserverApplication { public static void main(String[] args) { SpringApplication.run(BootAdminserverApplication.class, args); } }

避免端口冲突 更改端口号

 server.port=8000

启动测试一下

在这里插入图片描述

访问一下

http://localhost:8000

显示如下界面即启动成功

在这里插入图片描述

这时需要在我们的其他微服务应用中添加客户端依赖注册进来
需要注册进来的应用添加客户端依赖

  de.codecentricspring-boot-admin-starter-client2.4.3

我们现在拿一个以前写过的springboot项目 充当客户端

我们在以前的项目中引入两个依赖

第一个依赖开启springboot的指标监控actuator需要的jar包

  org.springframework.bootspring-boot-starter-actuator de.codecentricspring-boot-admin-starter-client2.4.3

我们在配置文件中增加配置信息

 spring: boot: admin: client:   # 可视化服务的地址  我们注册到哪里的端口号 url: http://localhost:8000 application:   #应用的名字 name: boot-web #management 是所有actuator的配置 #management.endpoint.端点名.xxx 对某个端点的具体配置 management: endpoints: enabled-by-default: true   #默认开启所有监控端点 web: exposure: include: '*'   #以web方式暴露端点

我们启动客户端应用 回来查看监控服务器页面

我们发现程序注册进来了

在这里插入图片描述
在这里插入图片描述

我们可以点击这个应用墙程序进来 看见详细信息

在这里插入图片描述

这只是简单实例详细的信息大家可以看github的开源项目介绍

项目

到此这篇关于springboot Actuator的指标监控可视化的文章就介绍到这了,更多相关springboot Actuator指标监控内容请搜索html中文网以前的文章或继续浏览下面的相关文章希望大家以后多多支持html中文网!

以上就是springboot Actuator的指标监控可视化功能详解的详细内容,更多请关注0133技术站其它相关文章!

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