kolla-ansible/ansible/roles/prometheus/templates/prometheus.yml.j2
Jorge Niedbalski 1596475db6 [prometheus] Initial implementation of prometheus-alertmanager
This patch extends the prometheus role for being able
to deploy the prometheus-alertmanager[0] container.

The variable enable_prometheus_alertmanager
decides if the container should be deployed and enabled.

If enabled, the following configuration and actions are performed:

- The alerting section on the prometheus-server configuration
is added pointing the prometheus-alertmanager host group as targets.

- HAProxy is configured to load-balance over the prometheus-alertmanager
host group. (external/internal).

Please note that a default (dummy) configuration is provided, that
allows the service to start, the operator should extend it via a node custom config

[0] https://github.com/openstack/kolla/tree/master/docker/prometheus/prometheus-alertmanager

Change-Id: I3a13342c67744a278cc8d52900a913c3ccc452ae
Closes-Bug: 1774725
Signed-off-by: Jorge Niedbalski <jorge.niedbalski@linaro.org>
2018-07-11 16:20:35 -04:00

70 lines
2.4 KiB
Django/Jinja

global:
scrape_interval: 60s
scrape_timeout: 10s
evaluation_interval: 15s
external_labels:
monitor: 'kolla'
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
{% for host in groups['prometheus'] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ prometheus_port }}'
{% endfor %}
{% if enable_prometheus_node_exporter | bool %}
- job_name: node
static_configs:
- targets:
{% for host in groups['prometheus-node-exporter'] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_node_exporter_port'] }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_mysqld_exporter | bool %}
- job_name: mysqld
static_configs:
- targets:
{% for host in groups['prometheus-mysqld-exporter'] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_mysqld_exporter_port'] }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_haproxy_exporter | bool %}
- job_name: haproxy
static_configs:
- targets:
{% for host in groups['prometheus-haproxy-exporter'] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_haproxy_exporter_port'] }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_memcached_exporter | bool %}
- job_name: memcached
static_configs:
- targets:
{% for host in groups['prometheus-memcached-exporter'] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_memcached_exporter_port'] }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_cadvisor | bool %}
- job_name: cadvisor
static_configs:
- targets:
{% for host in groups["prometheus-cadvisor"] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_cadvisor_port'] }}'
{% endfor %}
{% endif %}
{% if enable_prometheus_alertmanager | bool %}
alerting:
alertmanagers:
- static_configs:
- targets:
{% for host in groups["prometheus-alertmanager"] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% endfor %}
{% endif %}