勤杂工

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
统计
 

在github 上下载springboot 项目地址:

https://github.com/hgwz/jmeter-springboot-server

 

1在springboot项目中配置prometheus 的依赖

在pom.xml 文件依赖如下:

<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.github.mweirauch</groupId>
<artifactId>micrometer-jvm-extras</artifactId>
<version>0.1.2</version>
</dependency>

2在application中加入如下配置
management.metrics.export.prometheus.enabled=true
management.metrics.export.prometheus.step=1ms
management.metrics.export.prometheus.descriptions=true

management.endpoint.prometheus.enabled=true
management.endpoints.web.exposure.include=health,info,env,prometheus,metrics,httptrace,threaddump,heapdump,springmetrics

3重启下springboot项目加载配置项

4在浏览器中输入http://localhost:8089/actuator/prometheus 查看是否有对应的数据,如果有说明配置成功

 

 

 5配置prometheus 的jvm信息节点

信息如下:

- job_name: 'prometheus1'
metrics_path: '/actuator/prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.

static_configs:
- targets: ['localhost:8089']

这里特别注意 metrics_path 后面的信息值必须要有空格 ,否则prometheus 启动报错

 

 

重启下prometheus

在浏览器中输入http://localhost:9090/targets
可以查看对应配置节点信息

 

 在grafana中展示prometheus 采集的数据点

启动garafana,然后在浏览器中输入localhost:3000  

输入用户名密码(admin/admin)

dashboard 直接导入9568 或者去官网查询

 

 按照条件查找到的结果9568

在garafana中配置prometheus 的数据源

 

 

 到这基本配置结束

 

  



posted on   勤杂工  阅读(2224)  评论(0编辑  收藏  举报
编辑推荐:
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
 
点击右上角即可分享
微信分享提示