Skip to content

Instantly share code, notes, and snippets.

@trastle
Last active June 12, 2023 16:17
Show Gist options
  • Save trastle/1aa205354577ef0b329d4b8cc84c674a to your computer and use it in GitHub Desktop.
Save trastle/1aa205354577ef0b329d4b8cc84c674a to your computer and use it in GitHub Desktop.
global:
scrape_interval: 60s
external_labels:
monitor: 'example'
rule_files:
- /etc/prometheus/config/*.rules
scrape_configs:
- job_name: 'scrape-then-use-relabel-to-rename-selected-metrics'
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: 'scrape-then-use-relabel-to-remove-a-label'
static_configs:
- targets: ['10.10.10.2:19126']
metric_relabel_configs:
- source_labels: [ host ]
target_label: host
action: replace
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
action: replace
replacement: log-downloader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment