Skip to content
47 changes: 6 additions & 41 deletions ansible/roles/prometheus/templates/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,48 +388,13 @@ scrape_configs:
- job_name: "testlists"
static_configs:
- targets:
- testlists.dev.ooni.io:9102
# - testlists.prod.ooni.io:9102
- testlist-ec2.prod.ooni.io
- testlist-ec2.dev.ooni.io
scrape_interval: 5s
scheme: https
relabel_configs: # Change the host to the proxy host with relabeling
# Store ip in ecs_host
- source_labels: [__address__]
regex: "([a-z\\.]+):([0-9]+)" # <host>:<port>"
replacement: "$1"
target_label: "ec2_host"
action: "replace"
# Extract environment from address
- source_labels: [__address__]
regex: ".*(dev|prod).*"
replacement: "$1"
target_label: "env"
action: "replace"
# Store the full adress with path in proxy_host
- source_labels: [__address__]
regex: "([a-z\\.]+):([0-9]+)" # <host>:<port>
replacement: "{{monitoring_proxy_host}}:9200/${1}/${2}/metrics" # proxy.org:9200/<hostname>/<port>/metrics
target_label: "__proxy_host"
action: "replace"
# Change the environment part in proxy host
- source_labels: [__proxy_host, env]
separator: ";"
regex: "([^;]*)ENV([^;]*);(.*)" # __proxy_host;env
replacement: "$1$3$2"
target_label: "__proxy_host"
action: "replace"
# Change the address where to send the scrape request to
- source_labels: [__proxy_host]
regex: "([^/]*)/(.*)"
replacement: "$1"
target_label: "__address__"
action: "replace"
# Change the metrics path to include ip address and /metrics path
- source_labels: [__proxy_host]
regex: "([^/]*)/(.*)"
replacement: "/$2"
target_label: "__metrics_path__"
action: "replace"
scheme: http
basic_auth:
username: 'prom'
password: '{{ prometheus_metrics_password }}'

- job_name: "airflow"
scheme: https
Expand Down
Loading