Skip to content

Instantly share code, notes, and snippets.

@britcey
Created March 20, 2018 16:13
Show Gist options
  • Select an option

  • Save britcey/91a912c28123960a180ac42547050665 to your computer and use it in GitHub Desktop.

Select an option

Save britcey/91a912c28123960a180ac42547050665 to your computer and use it in GitHub Desktop.
labels for prometheus targets
- job_name: 'ping'
scrape_interval: 10s
scrape_timeout: 5s
metrics_path: /probe
params:
module: [icmp_ipv4]
static_configs:
- targets:
- lab.example.com;dev1;192.168.1.1
- lab.example.com;kvm;192.168.16.1
- lab.example.com;trusted;172.27.3.4
labels:
location: lab
relabel_configs:
- source_labels: [__address__] # add device name label
regex: '(.*);(.*);(.*)'
target_label: instance
replacement: $1
- source_labels: [__address__] # add interface name label
regex: '(.*);(.*);(.*)'
target_label: interface
replacement: $2
- source_labels: [__address__] # add the IP label
regex: '(.*);(.*);(.*)'
target_label: ip
replacement: $3
- source_labels: [ip] # set the target to the IP
target_label: __param_target
- target_label: __address__
replacement: 127.0.0.1:9115 # Blackbox exporter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment