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

29 lines
753 B
Plaintext

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 %}
- job_name: 'postfix_exporter'
static_configs:
- targets:
{% for host in groups['all'] %}
{% if hostvars[host]['postfix_enabled'] is defined and hostvars[host]['postfix_enabled'] %}
- '{{ hostvars[host]["ansible_host"] }}:9154'
{% endif %}
{% endfor %}