Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,28 @@ scrape_configs:

# Label the instances with their name and availability zone
- source_labels: [__meta_ec2_tag_Name, __meta_ec2_availability_zone]
target_label: instance
target_label: instance
replacement: "${1}-${2}"

- job_name: 'jarvis'
ec2_sd_configs:
- region: us-east-1
port: 8444
scheme: http # Ensure Prometheus uses HTTP
metrics_path: /jarvis/metrics
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_private_ip]
regex: (.*)
target_label: __address__
replacement: "${1}:8444"

# Label the instances with their name and availability zone
- source_labels: [__meta_ec2_tag_Name, __meta_ec2_availability_zone]
target_label: instance
replacement: "${1}-${2}"