prometheus 配置支持consul动态拉取

摘要:
/etc/prometheus/prometheus.yml-job_name:'consul'consul_sd_configs:-server:'consul-dev.cmsp-dev.svc.cluster.local:8500'scrape_interval:5s#myglobalconfigglobal:scrape_interval:60s#Setthescrapeintervalto

/etc/prometheus/prometheus.yml

- job_name: 'consul'consul_sd_configs:
      - server: 'consul-dev.cmsp-dev.svc.cluster.local:8500'scrape_interval: 5s
# my global config
global:
  scrape_interval:     60s # Set the scrape interval to every 15 seconds. Default is every 1minute.
  evaluation_interval: 60s # Evaluate rules every 15 seconds. The default is every 1minute.
  # scrape_timeout is set to the global default(10s).

# Alertmanager configuration
#alerting:
#  alertmanagers:
#  -static_configs:
#    -targets:
#      # - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
#rule_files:
  # - "first_rules.yml"# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from thisconfig.
  # - job_name: 'prometheus'
  #   # metrics_path defaults to '/metrics'#   # scheme defaults to 'http'.

  #   static_configs:
  #   - targets: ['localhost:9090']
#  - job_name: 'pushgateway'#    honor_labels: true#    static_configs:
#      - targets: [192.168.2.81:32006]
#        labels:
#          instance: pushgateway
#    metric_relabel_configs:
#      - regex: 'timestamp'#        action: labeldrop
#  - job_name: 'proxy'#    static_configs:
#      - targets: [proxy.cmsp-dev.svc.cluster.local:31026]
#        labels:
#          instance: proxy
#    scrape_interval: 5s
#  - job_name: 'datadog'#    static_configs:
#      - targets: [192.168.2.133:31636]
#        labels:
#          instance: datadog
#    scrape_interval: 30s
  - job_name: 'consul'consul_sd_configs:
      - server: 'consul-dev.cmsp-dev.svc.cluster.local:8500'scrape_interval: 5s

免责声明:文章转载自《prometheus 配置支持consul动态拉取》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇(转)SqlServer为大数据量表建索引SIGPIPE信号详解下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Grafana与Prometheus集成(四)

一、安装Grafana 1.1 Grafana是一款用Go语言开发的开源数据可视化工具,可以做数据监控和数据统计,带有告警功能。 https://grafana.com/grafana/download wget https://dl.grafana.com/oss/release/grafana-6.7.3-1.x86_64.rpm yum instal...

Prometheus监控学习笔记之360基于Prometheus的在线服务监控实践

0x00 初衷 最近参与的几个项目,无一例外对监控都有极强的要求,需要对项目中各组件进行详细监控,如服务端API的请求次数、响应时间、到达率、接口错误率、分布式存储中的集群IOPS、节点在线情况、偏移量等。 比较常见的方式是写日志,将日志采集到远端进行分析和绘图,或写好本地监控脚本进行数据采集后,通过监控系统客户端push到监控系统中进行打点。基本上我们需...

docker 环境下通过ocelot和consul 实现服务发现与自治

Ocelot介绍 Ocelot的目标对象是使用.NET运行面向微服务/服务的架构,需要统一的入口点进入他们的系统。 特别是我希望与IdentityServer引用和承载令牌轻松集成。 Ocelot是一组按特定顺序排列的中间件。 Ocelot将HttpRequest对象操作到其配置指定的状态,直到它到达请求构建器中间件,在该中间件中,它创建一个HttpReq...

Prometheus+Alertmanager+Grafana监控组件容器化部署

直接上部署配置文件 docker-compose.yml version: '3' networks: monitor: driver: bridge services: prometheus: image: prom/prometheus container_name: prometheus hostname: promet...

consul注册中心如何自动剔除下线服务

背景:consul注册中心,对已经下线的服务不会立刻剔除,过了很久才会剔除,这样会导致很多问题,例如a服务明明已经下线,但还在注册中心注册,这样其他服务可能就会访问到该服务 处理思路:我们可以监听spring的关闭事件,然后在该监听方法中剔除下线的服务即可:  注册中心已经有2个服务,第二个是我本地启动的服务,那么我们如何剔除它呢: @Component...

prometheus使用三(自定义监控指标实现)

  prometheus提供了一系列的export帮助采集各种容器和中间件的运行指标,但有时我们还需要更灵活的监控指标,介绍一下自定义监控指标        本文用来监控dubbo的服务提供者的被调用指标,包括调用次数,p99等。        首先引入jar包 <dependency> <groupId>io.prometheu...