Skip to content

Instantly share code, notes, and snippets.

@trastle
Last active June 12, 2023 16:17

Revisions

  1. trastle revised this gist May 28, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions prometheus.yml
    Original file line number Diff line number Diff line change
    @@ -34,4 +34,5 @@ scrape_configs:
    metric_relabel_configs:
    - source_labels: [ instance ]
    target_label: instance
    action: replace
    replacement: log-downloader
  2. trastle revised this gist May 28, 2017. No changes.
  3. trastle revised this gist May 28, 2017. No changes.
  4. trastle revised this gist May 28, 2017. No changes.
  5. trastle revised this gist May 28, 2017. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions prometheus.yml
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ rule_files:

    scrape_configs:

    - job_name: 'telegraf-app-1'
    - job_name: 'scrape-then-use-relabel-to-rename-selected-metrics'
    static_configs:
    - targets: ['10.10.10.1:19126']
    metric_relabel_configs:
    @@ -19,16 +19,19 @@ scrape_configs:
    action: replace
    replacement: telegraf_${1}

    - job_name: 'telegraf-app-2'
    - job_name: 'scrape-then-use-relabel-to-remove-a-label'
    static_configs:
    - targets: ['10.10.10.2:19126']
    metric_relabel_configs:
    - source_labels: [ __name__ ]
    target_label: __name__
    regex: '(^(?:go|http|process)_.*$)'
    action: replace
    replacement: telegraf_${1}
    - source_labels: [ host ]
    target_label: host
    action: replace
    replacement: ''
    replacement: ''

    - job_name: 'scrape-then-use-relabel-add-an-arbitrary-label'
    static_configs:
    - targets: ['10.10.10.3:19126']
    metric_relabel_configs:
    - source_labels: [ instance ]
    target_label: instance
    replacement: log-downloader
  6. trastle created this gist May 28, 2017.
    34 changes: 34 additions & 0 deletions prometheus.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    global:
    scrape_interval: 60s

    external_labels:
    monitor: 'example'

    rule_files:
    - /etc/prometheus/config/*.rules

    scrape_configs:

    - job_name: 'telegraf-app-1'
    static_configs:
    - targets: ['10.10.10.1:19126']
    metric_relabel_configs:
    - source_labels: [ __name__ ]
    target_label: __name__
    regex: '(^(?:go|http|process)_.*$)'
    action: replace
    replacement: telegraf_${1}

    - job_name: 'telegraf-app-2'
    static_configs:
    - targets: ['10.10.10.2:19126']
    metric_relabel_configs:
    - source_labels: [ __name__ ]
    target_label: __name__
    regex: '(^(?:go|http|process)_.*$)'
    action: replace
    replacement: telegraf_${1}
    - source_labels: [ host ]
    target_label: host
    action: replace
    replacement: ''