Skip to content

Commit

Permalink
prometheus config created
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Dec 18, 2024
1 parent 88c2e64 commit 423c6d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
global:
scrape_interval: 10s

scrape_configs:
- job_name: 'swarms'
ec2_sd_configs:
- region: us-east-1
port: 9100
scheme: http # Ensure Prometheus uses HTTP
relabel_configs:
# Keep only the EC2 instances with the tag Swarm set to superadmin
- source_labels: [__meta_ec2_tag_Swarm]
regex: superadmin
action: keep

# Extract the public IP from EC2 metadata and assign it to __address__
- source_labels: [__meta_ec2_public_ip]
regex: (.*)
target_label: __address__
replacement: "${1}:9100"

# Label the instances with their name and availability zone
- source_labels: [__meta_ec2_tag_Name, __meta_ec2_availability_zone]
target_label: instance

0 comments on commit 423c6d7

Please sign in to comment.