ansible/roles/prometheus/templates/prometheus.yml.j2
Jacob Babor 45904e221d Add Prometheus Blackbox for synthetics
Now the only thing I'm missing is an alerting system that actually works
and we'll be off to the races.
2024-07-09 18:03:55 -05:00

63 lines
1.6 KiB
Django/Jinja

# vim:ft=ansible:
---
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
# Default Prometheus job to monitor itself
- job_name: "prometheus"
static_configs:
- targets: ['localhost:9090']
# This is shipped by the Ansible role that deploys Prometheus
- job_name: "blackbox"
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
{% for host in groups['tags_nagios'] %}
{% for service in vars.services %}
{% for tag in service.tags %}
{% if tag.slug == "nagios-checkhttps" %}
{% for port in service.ports %}
- "https://{{ service.name }}:{{ port }}"
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox:9115
- job_name: "blackbox-exporter"
static_configs:
- targets: ['blackbox:9115']
# These two jobs are included for every node in our inventory
- job_name: "node-exporter"
static_configs:
- targets:
{% for host in groups['tags_nagios'] %}
- '{{ host }}:9100'
{% endfor %}
- job_name: "cadvisor-exporter"
static_configs:
- targets:
{% for host in groups['tags_nagios'] %}
- '{{ host }}:9101'
{% endfor %}
# This container is used on every psql machine
- job_name: "psql-exporter"
static_configs:
- targets:
{% for host in groups['tags_nagios-checkpgsql'] %}
- '{{ host }}:9102'
{% endfor %}