infra-konstrukt/roles/prometheus/templates/prometheus.yml

20 lines
479 B
YAML

global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets:
# Hier loopen wir durch ALLE Hosts im Inventory
{% for host in groups['all'] %}
# Wir nehmen nur Hosts, die eine IP haben (manche Gruppen sind leer)
{% if hostvars[host]['ansible_host'] is defined %}
- '{{ hostvars[host]["ansible_host"] }}:9100'
{% endif %}
{% endfor %}