pez-infra/ansible/services/prometheus/prometheus.yml.j2

79 lines
2.3 KiB
Django/Jinja

---
# Ansible managed — generated from prometheus.yml.j2
# Config file location on london-a: /usr/local/etc/prometheus.yml
# Prometheus runs as: /usr/local/bin/prometheus --config.file=/usr/local/etc/prometheus.yml
# Data directory: /var/db/prometheus
global:
scrape_interval: 15s
evaluation_interval: 15s
# Alerting notifications are handled by Grafana (unified alerting with
# PagerDuty + email contact points), not Alertmanager. No alerting:
# section is needed here. Prometheus still evaluates these rule_files
# so the ALERTS / ALERTS_FOR_STATE metrics are available for queries.
rule_files:
- /usr/local/etc/prometheus/rules/*.rules
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node_exporter"
static_configs:
{% for host in groups['all'] | sort %}
{% set h = hostvars[host] %}
{% if h.ansible_host is defined %}
- targets: ["{{ h.ansible_host }}:9100"]
labels:
location: {{ h.prometheus_location }}
server: {{ host }}
{% endif %}
{% endfor %}
- job_name: "smartmontools"
static_configs:
{% for host in groups['all'] | sort %}
{% set h = hostvars[host] %}
{% if 'smartctl-exporter' in (h.docker_services | default([])) %}
- targets: ["{{ h.ansible_host }}:9633"]
labels:
location: {{ h.prometheus_location }}
server: {{ host }}
{% endif %}
{% endfor %}
- job_name: "plex"
static_configs:
{% for host in groups['all'] | sort %}
{% set h = hostvars[host] %}
{% if 'plex-exporter' in (h.docker_services | default([])) %}
- targets: ["{{ h.ansible_host }}:9000"]
labels:
location: {{ h.prometheus_location }}
server: {{ host }}
{% endif %}
{% endfor %}
- job_name: "systemd_exporter"
static_configs:
{% for host in groups['systemd_exporter_hosts'] | sort %}
{% set h = hostvars[host] %}
- targets: ["{{ h.ansible_host }}:9558"]
labels:
location: {{ h.prometheus_location }}
server: {{ host }}
{% endfor %}
- job_name: "caddy"
static_configs:
{% for host in groups['all'] | sort %}
{% set h = hostvars[host] %}
{% if h.caddy_config_src is defined %}
- targets: ["{{ h.ansible_host }}:2019"]
labels:
location: {{ h.prometheus_location }}
server: {{ host }}
{% endif %}
{% endfor %}