当前位置: 首页 > news >正文

搭建线上jvm监控

这里写目录标题

  • Springboot项目配置
    • maven依赖
    • application.properties
    • 添加监控JVM的配置类
    • 启动springboot项目
  • Prometheus配置
  • 配置grafana

Springboot项目配置

maven依赖

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency><groupId>io.micrometer</groupId><artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

application.properties

spring.application.name=springboot
server.port=8080
management.endpoints.web.exposure.include=*
management.metrics.tags.application=${spring.application.name}  

添加监控JVM的配置类

@Bean
public MeterRegistryCustomizer<MeterRegistry> configurer(@Value("${spring.application.name}") String applicationName) {return registry -> registry.config().commonTags("application", applicationName);
}

启动springboot项目

访问 http://localhost:8080/actuator/prometheus 查看指标是否正常

Prometheus配置

- job_name: "jvm"# 多久采集一次数据scrape_interval: 5s# 采集时的超时时间scrape_timeout: 5s# 采集的路径metrics_path: '/actuator/prometheus'# 采集Springboot服务的地址static_configs:- targets: ['127.0.0.1:8080']

启动prometheus,查看指标情况 prometheus.exe --config.file=file(此启动方式是windows下,安装包解压后,在项目根目录下执行的命令)

http://localhost:9090/metrics

配置grafana

模板地址 https://grafana.com/grafana/dashboards

https://grafana.com/grafana/dashboards/4701-jvm-micrometer/

http://www.lryc.cn/news/241092.html

相关文章:

  • 【计算机网络笔记】数据链路层概述
  • vscode-insiders Remote-SSH XHR failed无法访问远程服务器
  • Ubuntu开机显示No bootable devices found
  • 设计模式——行为型模式(二)
  • SpringBoot中企业微信的API调用
  • [前端] V8引擎编译原理
  • 使用Pytorch实现linear_regression
  • 网络安全等级保护收费标准?
  • 16 Go的反射
  • SQL Server 百万数据查询优化技巧三十则
  • list转map(根据某个或多个属性分组)
  • 常见树种(贵州省):012茶、花椒、八角、肉桂、杜仲、厚朴、枸杞、忍冬
  • 千云物流 - 使用k8s负载均衡openelb
  • C语言之字符串函数
  • python中一个文件(A.py)怎么调用另一个文件(B.py)中定义的类AA详解和示例
  • spark shuffle 剖析
  • C语言之认识柔性数组(flexible array)
  • 【MATLAB基础绘图第17棒】绘制玫瑰图
  • Qt 基于海康相机的视频绘图
  • FlinkCDC实现主数据与各业务系统数据的一致性(瀚高、TIDB)
  • JSP:Servlet
  • react中的state
  • VR全景航拍要注意什么,航拍图片如何处理
  • Spark---集群搭建
  • Linux上通过SSL/TLS和start tls连接到LDAP服务器
  • 【华为OD题库-034】字符串化繁为简-java
  • 斯坦福大学引入FlashFFTConv来优化机器学习中长序列的FFT卷积
  • 信息系统项目管理师-干系人管理论文提纲
  • Windmill:最快的自托管开源工作流引擎
  • 线性代数 - 几何原理