Prometheus relabel_configs配置解释与通过外部文件动态获取配置信息

scrape_configs:
  # The job name is added as a label `job=` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

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

  - job_name: 'fileds'  
    file_sd_configs:  #通过文件去动态发现配置
    - refresh_interval: 1m #默认5分钟检查一次
      files:
       - targets.json #配置文件路径
#    relabel_configs:
#         - source_labels: [host]
#           target_label: job
#把host这个label变量的的值赋值给instance
#      - source_labels: [host]
#        target_label: instance
#改变instance的值为host这个字符串
#      - target_label: instance
#        replacement: host
#在client中自定义的label没有找到办法替换

你可能感兴趣的:(Prometheus relabel_configs配置解释与通过外部文件动态获取配置信息)