Merge "Support the prometheus elasticsearch exporter"

This commit is contained in:
Zuul 2019-03-13 17:00:50 +00:00 committed by Gerrit Code Review
commit ce08b31f5e
12 changed files with 91 additions and 0 deletions

View File

@ -360,6 +360,7 @@ prometheus_alertmanager_cluster_port: "9094"
# Prometheus openstack-exporter ports
prometheus_openstack_exporter_port: "9198"
prometheus_elasticsearch_exporter_port: "9108"
qdrouterd_port: "31459"
@ -997,9 +998,11 @@ enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
enable_prometheus_ceph_mgr_exporter: "{{ enable_ceph | bool and enable_prometheus | bool }}"
enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"
enable_prometheus_elasticsearch_exporter: "{{ enable_prometheus | bool and enable_elasticsearch | bool }}"
prometheus_alertmanager_user: "admin"
prometheus_openstack_exporter_interval: "60s"
prometheus_elasticsearch_exporter_interval: "60s"
############
# Vitrage

View File

@ -732,3 +732,6 @@ monitoring
[prometheus-openstack-exporter:children]
monitoring
[prometheus-elasticsearch-exporter:children]
elasticsearch

View File

@ -751,3 +751,6 @@ monitoring
[prometheus-openstack-exporter:children]
monitoring
[prometheus-elasticsearch-exporter:children]
elasticsearch

View File

@ -115,6 +115,16 @@ prometheus_services:
- "kolla_logs:/var/log/kolla/"
- "prometheus:/var/lib/prometheus"
dimensions: "{{ prometheus_openstack_exporter_dimensions }}"
prometheus-elasticsearch-exporter:
container_name: prometheus_elasticsearch_exporter
group: prometheus-elasticsearch-exporter
enabled: "{{ enable_prometheus_elasticsearch_exporter | bool }}"
image: "{{ prometheus_elasticsearch_exporter_image_full }}"
volumes:
- "{{ node_config_directory }}/prometheus-elasticsearch-exporter/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
dimensions: "{{ prometheus_elasticsearch_exporter_dimensions }}"
####################
# Database
@ -160,6 +170,10 @@ prometheus_openstack_exporter_image: "{{ docker_registry ~ '/' if docker_registr
prometheus_openstack_exporter_tag: "{{ prometheus_tag }}"
prometheus_openstack_exporter_image_full: "{{ prometheus_openstack_exporter_image }}:{{ prometheus_openstack_exporter_tag }}"
prometheus_elasticsearch_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-elasticsearch-exporter"
prometheus_elasticsearch_exporter_tag: "{{ prometheus_tag }}"
prometheus_elasticsearch_exporter_image_full: "{{ prometheus_elasticsearch_exporter_image }}:{{ prometheus_elasticsearch_exporter_tag }}"
prometheus_server_dimensions: "{{ default_container_dimensions }}"
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
@ -168,3 +182,4 @@ prometheus_memcached_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_cadvisor_dimensions: "{{ default_container_dimensions }}"
prometheus_alertmanager_dimensions: "{{ default_container_dimensions }}"
prometheus_openstack_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_elasticsearch_exporter_dimensions: "{{ default_container_dimensions }}"

View File

@ -168,3 +168,24 @@
- config_json.changed | bool
or prometheus_openstack_exporter_confs.changed | bool
or prometheus_container.changed | bool
- name: Restart prometheus-elasticsearch-exporter container
vars:
service_name: "prometheus-elasticsearch-exporter"
service: "{{ prometheus_services[service_name] }}"
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or prometheus_container.changed | bool

View File

@ -10,6 +10,7 @@
- prometheus_cadvisor
- prometheus_alertmanager
- prometheus_openstack_exporter
- prometheus_elasticsearch_exporter
register: container_facts
- name: Checking free port for Prometheus server
@ -111,3 +112,17 @@
- enable_prometheus_openstack_exporter | bool
with_items:
- "{{ prometheus_openstack_exporter_port }}"
- name: Checking free ports for Prometheus elasticsearch-exporter
wait_for:
host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
port: "{{ item }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['prometheus_elasticsearch_exporter'] is not defined
- inventory_hostname in groups['prometheus-elasticsearch-exporter']
- enable_prometheus_elasticsearch_exporter | bool
with_items:
- "{{ prometheus_elasticsearch_exporter_port }}"

View File

@ -0,0 +1,11 @@
{
"command": "/opt/elasticsearch_exporter/elasticsearch_exporter -es.uri http://{{ api_interface_address }}:{{ elasticsearch_port }} -web.listen-address {{ api_interface_address }}:{{ prometheus_elasticsearch_exporter_port }}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}
]
}

View File

@ -86,6 +86,16 @@ scrape_configs:
{% 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:

View File

@ -466,6 +466,7 @@
- prometheus-cadvisor
- prometheus-alertmanager
- prometheus-openstack-exporter
- prometheus-elasticsearch-exporter
- '&enable_prometheus_True'
serial: '{{ kolla_serial|default("0") }}'
roles:

View File

@ -558,3 +558,4 @@ tempest_floating_network_name:
#enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
#enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"
#enable_prometheus_elasticsearch_exporter: "{{ enable_prometheus | bool and enable_elasticsearch | bool }}"

View File

@ -0,0 +1,5 @@
---
features:
- |
Deploys and configures the prometheus-elasticsearch-exporter (https://github.com/justwatchcom/elasticsearch_exporter/)
as part of the prometheus monitoring exporters stack.

View File

@ -661,3 +661,6 @@ storage
[prometheus-openstack-exporter:children]
monitoring
[prometheus-elasticsearch-exporter:children]
elasticsearch