前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Prometheus for Spring Boot

Prometheus for Spring Boot

作者头像
十毛
发布2019-03-27 15:13:19
8990
发布2019-03-27 15:13:19
举报
文章被收录于专栏:用户1337634的专栏

前面两篇文章已经介绍如何搭建Prometheus和Grafana,本文介绍如何快速监控Spring Boot进程

快速接入

  • 引入Jar包(pom.xml
代码语言:javascript
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
  • 配置metrics(application.properties
代码语言:javascript
复制
#Metrics related configurations
management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true

prometheus监控指标

  • 修改Prometheus配置(prometheus.yml
代码语言:javascript
复制
#Global configurations
global:
  scrape_interval:     5s # Set the scrape interval to every 5 seconds.
  evaluation_interval: 5s # Evaluate rules every 5 seconds.
scrape_configs:
  - job_name: 'spring-boot'
    metrics_path: '/actuator/prometheus'
    static_configs:
      - targets: ['localhost:8080']
  • 重启Prometheus
代码语言:javascript
复制
./perometheus --config.file=prometheus.yml

配置Grafana

  • 配置指标jvm_memory_committed_bytes

image.png

  • 再配置更多指标
    • jvm_threads_states_threads
    • jvm_memory_used_bytes
    • process_cpu_usage
    • rate(http_server_requests_seconds_sum[5m])
    • jvm_gc_pause_seconds_count

参考

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019.03.04 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 快速接入
  • 配置Grafana
  • 参考
相关产品与服务
Prometheus 监控服务
Prometheus 监控服务(TencentCloud Managed Service for Prometheus,TMP)是基于开源 Prometheus 构建的高可用、全托管的服务,与腾讯云容器服务(TKE)高度集成,兼容开源生态丰富多样的应用组件,结合腾讯云可观测平台-告警管理和 Prometheus Alertmanager 能力,为您提供免搭建的高效运维能力,减少开发及运维成本。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档