
In a deployment where Prometheus is enabled and Alertmanager is disabled the task "Copying over prometheus config file" in 'ansible/roles/prometheus/tasks/config.yml' will fail to template the Prometheus configuration file 'ansible/roles/prometheus/templates/prometheus.yml.j2' as the variable 'prometheus_alert_rules' does not contain the key 'files'. This commit fixes this bug. Change-Id: Idbe1e52dd3693a6f168d475f9230a253dae64480 Closes-Bug: #1854540 (cherry picked from commit 991bdc5f558467403cc3d993ba5c53b5f89272f9)
108 lines
3.8 KiB
Django/Jinja
108 lines
3.8 KiB
Django/Jinja
global:
|
|
scrape_interval: 60s
|
|
scrape_timeout: 10s
|
|
evaluation_interval: 15s
|
|
external_labels:
|
|
monitor: 'kolla'
|
|
|
|
{% if prometheus_alert_rules.files is defined and prometheus_alert_rules.files | length > 0 %}
|
|
rule_files:
|
|
{% for rule in prometheus_alert_rules.files %}
|
|
- "/etc/prometheus/{{ rule.path | basename }}"
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
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_ceph_mgr_exporter | bool %}
|
|
- job_name: ceph_mgr_exporter
|
|
honor_labels: true
|
|
static_configs:
|
|
- targets:
|
|
{% for host in groups["ceph-mgr"] %}
|
|
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_ceph_mgr_exporter_port'] }}'
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if enable_prometheus_openstack_exporter | bool %}
|
|
- job_name: openstack_exporter
|
|
scrape_interval: {{ prometheus_openstack_exporter_interval }}
|
|
honor_labels: true
|
|
static_configs:
|
|
- targets:
|
|
{% for host in groups["prometheus-openstack-exporter"] %}
|
|
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_openstack_exporter_port'] }}'
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
{% if enable_prometheus_elasticsearch_exporter | bool %}
|
|
- job_name: elasticsearch_exporter
|
|
scrape_interval: {{ prometheus_elasticsearch_exporter_interval }}
|
|
static_configs:
|
|
- targets:
|
|
{% for host in groups["prometheus-elasticsearch-exporter"] %}
|
|
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_elasticsearch_exporter_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 %}
|