Skip to content

chore: setup jarvis in prometheus config #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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}"