Skip to content

Instantly share code, notes, and snippets.

@john-delivuk
Created March 20, 2018 18:26
Show Gist options
  • Save john-delivuk/ac97e40c0a2e5542fe1ac2fe7ac43cbe to your computer and use it in GitHub Desktop.
Save john-delivuk/ac97e40c0a2e5542fe1ac2fe7ac43cbe to your computer and use it in GitHub Desktop.
A great starting place for an ec2 node exporter which binds metadata and tags.
- job_name: service-ec2
scrape_interval: 5s
scrape_timeout: 5s
metrics_path: /metrics
scheme: http
ec2_sd_configs:
- region: us-east-1
refresh_interval: 1m
port: 9100
relabel_configs:
- source_labels: [__meta_ec2_tag_prometheus_io_scrape]
separator: ;
regex: "true"
replacement: $1
action: keep
- separator: ;
regex: __meta_ec2_tag_(.+)
replacement: $1
action: labelmap
- source_labels: [__meta_ec2_instance_id]
separator: ;
regex: (.*)
target_label: ec2_instance_id
replacement: $1
action: replace
- source_labels: [__meta_ec2_availability_zone]
separator: ;
regex: (.*)
target_label: ec2_availability_zone
replacement: $1
action: replace
- source_labels: [__meta_ec2_instance_id]
separator: ;
regex: (.*)
target_label: ec2_instance_id
replacement: $1
action: replace
- source_labels: [__meta_ec2_instance_type]
separator: ;
regex: (.*)
target_label: ec2_instance_type
replacement: $1
action: replace
- source_labels: [__meta_ec2_instance_state]
separator: ;
regex: (.*)
target_label: ec2_instance_state
replacement: $1
action: replace
- source_labels: [__meta_ec2_vpc_id]
separator: ;
regex: (.*)
target_label: ec2_vpc_id
replacement: $1
action: replace
- source_labels: [__meta_ec2_subnet_id]
separator: ;
regex: (.*)
target_label: ec2_subnet_id
replacement: $1
action: replace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment