ZBLOG

在原有 Prometheus 的配置文件中,修改 scrape_configs 部分中的 targets 参数为 prom-aggregation-gateway 的地址,给个对比demo

假设 prom-aggregation-gateway 的地址为 192.168.1.100:8080,那么在 Prometheus 的配置文件中,需要将原有的 scrape_configs 部分中的 targets 参数修改为该地址。下面是一个对比示例:

修改前的配置文件:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
- job_name: 'node'
  static_configs:
    - targets: ['localhost:9100']

- job_name: 'prometheus'
  static_configs:
    - targets: ['localhost:9090']

修改后的配置文件:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
- job_name: 'node'
  static_configs:
    - targets: ['localhost:9100']

- job_name: 'prometheus'
  static_configs:
    - targets: ['localhost:9090']

# 新增一个名为 aggregated-metrics 的 job,并修改 targets 参数为 prom-aggregation-gateway 的地址。
- job_name: 'aggregated-metrics'
  metrics_path: '/metrics/aggregated'
  scrape_interval: 30s
  scrape_timeout: 10s
  scheme: http
  honor_labels: true
   relabel_configs:
     - source_labels : [__meta_consul_service_port]
       regex         : ".*"
       action        : replace
       target_label   : __address__
     - source_labels : [__meta_consul_service_address, __meta_consul_service_tags]
       regex         : "(.*);environment=prod(,.*)?"
       replacement   : "${1}"
       action        : replace
       target_label   : instance
      

从上面的对比可以看出,只需要在原有的配置文件中新增一个名为 aggregated-metrics 的 job,并将其中的 targets 参数修改为 prom-aggregation-gateway 的地址即可。其他部分保持不变。

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=5928

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?