41 lines
1.2 KiB
Django/Jinja
41 lines
1.2 KiB
Django/Jinja
#jinja2: trim_blocks: True, lstrip_blocks: True
|
|
{{ ansible_managed | comment }}
|
|
# http://prometheus.io/docs/operating/configuration/
|
|
|
|
global:
|
|
scrape_interval: 5s
|
|
scrape_timeout: 5s
|
|
|
|
rule_files:
|
|
- {{ prometheus_config_dir }}/rules/*.rules
|
|
|
|
alerting:
|
|
alertmanagers:
|
|
- scheme: http
|
|
static_configs:
|
|
- targets:
|
|
- "localhost:{{ alertmanager_port }}"
|
|
timeout: 10s
|
|
{% if prometheus_alert_relabel_configs | length > 0 %}
|
|
alert_relabel_configs:
|
|
{{ prometheus_alert_relabel_configs | to_nice_yaml(indent=2) | indent(2,False) }}
|
|
{% endif %}
|
|
|
|
scrape_configs:
|
|
{% for host in groups['all'] %}
|
|
{% with
|
|
node_exporter_password = hostvars[host].node_exporter_password | default(node_exporter_password),
|
|
node_exporter_path = hostvars[host].node_exporter_path | default(node_exporter_path),
|
|
node_exporter_public_port = hostvars[host].node_exporter_public_port | default(node_exporter_public_port)
|
|
%}
|
|
- job_name: 'node-exporter-{{ host }}'
|
|
basic_auth:
|
|
username: admin
|
|
password: {{ node_exporter_password }}
|
|
metrics_path: {{ node_exporter_path }}
|
|
static_configs:
|
|
- targets:
|
|
- '{{ host }}:{{ node_exporter_public_port }}'
|
|
{% endwith %}
|
|
{% endfor %}
|