promethues 集成eureka 服务发现

prometheus 从v2.22 开始支持基于eureka的服务发现配置了(内置),对于基于eureka 的spring cloud
微服务解决方案的监控就很方便了,以下是一个简单的试用

环境准备

  • docker-compose 文件
 
version: "3"
services:
  g:
    image: grafana/grafana
    ports:
    - "3000:3000"
  p:
    image: prom/prometheus
    volumes:
    - "./prometheus.yml:/etc/prometheus/prometheus.yml"
    ports:
    - "9090:9090" 
  • prometheus.yml 配置
global:
  scrape_interval:     10s
  evaluation_interval: 10s
scrape_configs:
  - job_name: eureka
    metrics_path: /metrics
    eureka_sd_configs:
    - server: <your eureka address>/eureka

启动&&效果

  • 启动
docker-compose up -d
  • 效果

因为我使用本机,访问的是k8s部署的eureka 服务,所有状态是down

 

 

说明

当然一个好消息是VictoriaMetrics 的vmagent 也是支持eureka的服务发现的

参考资料

https://github.com/prometheus/prometheus/blob/release-2.23/documentation/examples/prometheus-eureka.yml
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#eureka_sd_config
https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.48.0

posted on   荣锋亮  阅读(1319)  评论(8编辑  收藏  举报

编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· 上周热点回顾(2.17-2.23)
· 如何使用 Uni-app 实现视频聊天(源码,支持安卓、iOS)
· spring官宣接入deepseek,真的太香了~
历史上的今天:
2018-12-04 skipper lua 脚本支持
2018-12-04 skipper 内置的常用filters
2018-12-04 skipper prometheus 监控
2018-12-04 skipper http router 简单试用
2018-12-04 skipper http router 工具
2014-12-04 OPENQUERY用法以及使用需要注意的地方

导航

< 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
点击右上角即可分享
微信分享提示