[prometheus] Support the prometheus openstack exporter
This patch implements the initial support for the openstack-exporter[0] in the kolla-ansible prometheus monitoring system. The configuration and prechecks are reused from the other exporters and a new template is provided for generating a os-client-config file required by the exporter. The default scrape interval is 60 seconds, but it can be extended via a configuration option. [0] https://github.com/Linaro/openstack-exporter Change-Id: I4a34c4bb56e74b5cd544972cbd6540d9acb6e4a1
This commit is contained in:
parent
20c58a9c53
commit
6c64b7c732
@ -304,6 +304,10 @@ prometheus_cadvisor_port: "18080"
|
|||||||
# Prometheus alertmanager ports
|
# Prometheus alertmanager ports
|
||||||
prometheus_alertmanager_port: "9093"
|
prometheus_alertmanager_port: "9093"
|
||||||
prometheus_alertmanager_cluster_port: "9094"
|
prometheus_alertmanager_cluster_port: "9094"
|
||||||
|
|
||||||
|
# Prometheus openstack-exporter ports
|
||||||
|
prometheus_openstack_exporter_port: "9198"
|
||||||
|
|
||||||
qdrouterd_port: "31459"
|
qdrouterd_port: "31459"
|
||||||
|
|
||||||
rabbitmq_port: "5672"
|
rabbitmq_port: "5672"
|
||||||
@ -924,7 +928,10 @@ enable_prometheus_memcached_exporter: "{{ enable_memcached | bool }}"
|
|||||||
enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
|
enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
|
||||||
enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
|
enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
|
||||||
enable_prometheus_ceph_mgr_exporter: "{{ enable_ceph | bool and enable_prometheus | bool }}"
|
enable_prometheus_ceph_mgr_exporter: "{{ enable_ceph | bool and enable_prometheus | bool }}"
|
||||||
|
enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"
|
||||||
|
|
||||||
prometheus_alertmanager_user: "admin"
|
prometheus_alertmanager_user: "admin"
|
||||||
|
prometheus_openstack_exporter_interval: "60s"
|
||||||
|
|
||||||
############
|
############
|
||||||
# Vitrage
|
# Vitrage
|
||||||
|
@ -732,3 +732,6 @@ storage
|
|||||||
|
|
||||||
[prometheus-alertmanager:children]
|
[prometheus-alertmanager:children]
|
||||||
monitoring
|
monitoring
|
||||||
|
|
||||||
|
[prometheus-openstack-exporter:children]
|
||||||
|
monitoring
|
||||||
|
@ -751,3 +751,6 @@ storage
|
|||||||
|
|
||||||
[prometheus-alertmanager:children]
|
[prometheus-alertmanager:children]
|
||||||
monitoring
|
monitoring
|
||||||
|
|
||||||
|
[prometheus-openstack-exporter:children]
|
||||||
|
monitoring
|
||||||
|
@ -104,6 +104,17 @@ prometheus_services:
|
|||||||
port: "{{ prometheus_alertmanager_port }}"
|
port: "{{ prometheus_alertmanager_port }}"
|
||||||
auth_user: "{{ prometheus_alertmanager_user }}"
|
auth_user: "{{ prometheus_alertmanager_user }}"
|
||||||
auth_pass: "{{ prometheus_alertmanager_password }}"
|
auth_pass: "{{ prometheus_alertmanager_password }}"
|
||||||
|
prometheus-openstack-exporter:
|
||||||
|
container_name: "prometheus_openstack_exporter"
|
||||||
|
group: "prometheus-openstack-exporter"
|
||||||
|
enabled: "{{ enable_prometheus_openstack_exporter | bool }}"
|
||||||
|
image: "{{ prometheus_openstack_exporter_image_full }}"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/prometheus-openstack-exporter/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
- "prometheus:/var/lib/prometheus"
|
||||||
|
dimensions: "{{ prometheus_openstack_exporter_dimensions }}"
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Database
|
# Database
|
||||||
@ -144,6 +155,10 @@ prometheus_alertmanager_image: "{{ docker_registry ~ '/' if docker_registry else
|
|||||||
prometheus_alertmanager_tag: "{{ openstack_release }}"
|
prometheus_alertmanager_tag: "{{ openstack_release }}"
|
||||||
prometheus_alertmanager_image_full: "{{ prometheus_alertmanager_image }}:{{ prometheus_alertmanager_tag }}"
|
prometheus_alertmanager_image_full: "{{ prometheus_alertmanager_image }}:{{ prometheus_alertmanager_tag }}"
|
||||||
|
|
||||||
|
# Prometheus openstack_exporter
|
||||||
|
prometheus_openstack_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-prometheus-openstack-exporter"
|
||||||
|
prometheus_openstack_exporter_tag: "{{ openstack_release }}"
|
||||||
|
prometheus_openstack_exporter_image_full: "{{ prometheus_openstack_exporter_image }}:{{ prometheus_openstack_exporter_tag }}"
|
||||||
prometheus_server_dimensions: "{{ default_container_dimensions }}"
|
prometheus_server_dimensions: "{{ default_container_dimensions }}"
|
||||||
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
|
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
|
||||||
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
|
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
|
||||||
@ -151,3 +166,4 @@ prometheus_node_exporter_dimensions: "{{ default_container_dimensions }}"
|
|||||||
prometheus_memcached_exporter_dimensions: "{{ default_container_dimensions }}"
|
prometheus_memcached_exporter_dimensions: "{{ default_container_dimensions }}"
|
||||||
prometheus_cadvisor_dimensions: "{{ default_container_dimensions }}"
|
prometheus_cadvisor_dimensions: "{{ default_container_dimensions }}"
|
||||||
prometheus_alertmanager_dimensions: "{{ default_container_dimensions }}"
|
prometheus_alertmanager_dimensions: "{{ default_container_dimensions }}"
|
||||||
|
prometheus_openstack_exporter_dimensions: "{{ default_container_dimensions }}"
|
||||||
|
@ -147,3 +147,24 @@
|
|||||||
- config_json.changed | bool
|
- config_json.changed | bool
|
||||||
or prometheus_alertmanager_confs.changed | bool
|
or prometheus_alertmanager_confs.changed | bool
|
||||||
or prometheus_container.changed | bool
|
or prometheus_container.changed | bool
|
||||||
|
|
||||||
|
- name: Restart prometheus-openstack-exporter container
|
||||||
|
vars:
|
||||||
|
service_name: "prometheus-openstack-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 }}"
|
||||||
|
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_openstack_exporter_confs.changed | bool
|
||||||
|
or prometheus_container.changed | bool
|
||||||
|
@ -106,6 +106,23 @@
|
|||||||
notify:
|
notify:
|
||||||
- Restart prometheus-mysqld-exporter container
|
- Restart prometheus-mysqld-exporter container
|
||||||
|
|
||||||
|
- name: Copying cloud config file for openstack exporter
|
||||||
|
vars:
|
||||||
|
service: "{{ prometheus_services['prometheus-openstack-exporter'] }}"
|
||||||
|
template:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ node_config_directory }}/prometheus-openstack-exporter/clouds.yml"
|
||||||
|
register: prometheus_openstack_exporter_confs
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
with_first_found:
|
||||||
|
- "{{ node_custom_config }}/prometheus-openstack-exporter/{{ inventory_hostname }}/clouds.yml"
|
||||||
|
- "{{ node_custom_config }}/prometheus-openstack-exporter/clouds.yml"
|
||||||
|
- "{{ role_path }}/templates/clouds.yml.j2"
|
||||||
|
notify:
|
||||||
|
- Restart prometheus-openstack-exporter container
|
||||||
|
|
||||||
- name: Check prometheus containers
|
- name: Check prometheus containers
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
- prometheus_mysqld_exporter
|
- prometheus_mysqld_exporter
|
||||||
- prometheus_cadvisor
|
- prometheus_cadvisor
|
||||||
- prometheus_alertmanager
|
- prometheus_alertmanager
|
||||||
|
- prometheus_openstack_exporter
|
||||||
register: container_facts
|
register: container_facts
|
||||||
|
|
||||||
- name: Checking free port for Prometheus server
|
- name: Checking free port for Prometheus server
|
||||||
@ -96,3 +97,17 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- "{{ prometheus_alertmanager_port }}"
|
- "{{ prometheus_alertmanager_port }}"
|
||||||
- "{{ prometheus_alertmanager_cluster_port }}"
|
- "{{ prometheus_alertmanager_cluster_port }}"
|
||||||
|
|
||||||
|
- name: Checking free ports for Prometheus openstack-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_openstack_exporter'] is not defined
|
||||||
|
- inventory_hostname in groups['prometheus-openstack-exporter']
|
||||||
|
- enable_prometheus_openstack_exporter | bool
|
||||||
|
with_items:
|
||||||
|
- "{{ prometheus_openstack_exporter_port }}"
|
||||||
|
12
ansible/roles/prometheus/templates/clouds.yml.j2
Normal file
12
ansible/roles/prometheus/templates/clouds.yml.j2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
clouds:
|
||||||
|
default:
|
||||||
|
region_name: {{ openstack_region_name }}
|
||||||
|
identity_api_version: 3
|
||||||
|
identity_interface: internal
|
||||||
|
auth:
|
||||||
|
username: {{ keystone_admin_user }}
|
||||||
|
password: {{ keystone_admin_password }}
|
||||||
|
project_name: {{ keystone_admin_project }}
|
||||||
|
project_domain_name: 'Default'
|
||||||
|
user_domain_name: 'Default'
|
||||||
|
auth_url: {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}/v3
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"command": "/opt/openstack-exporter/openstack-exporter --os-client-config=/etc/openstack/clouds.yml --web.listen-address={{ api_interface_address }}:{{ prometheus_openstack_exporter_port }} default",
|
||||||
|
"config_files": [
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/clouds.yml",
|
||||||
|
"dest": "/etc/openstack/clouds.yml",
|
||||||
|
"owner": "prometheus",
|
||||||
|
"perm": "0600"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"path": "/data",
|
||||||
|
"owner": "prometheus:kolla",
|
||||||
|
"recurse": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/var/log/kolla/prometheus",
|
||||||
|
"owner": "prometheus:kolla",
|
||||||
|
"recurse": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -75,6 +75,17 @@ scrape_configs:
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% 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_alertmanager | bool %}
|
{% if enable_prometheus_alertmanager | bool %}
|
||||||
alerting:
|
alerting:
|
||||||
alertmanagers:
|
alertmanagers:
|
||||||
|
@ -464,6 +464,8 @@
|
|||||||
- prometheus-mysqld-exporter
|
- prometheus-mysqld-exporter
|
||||||
- prometheus-haproxy-exporter
|
- prometheus-haproxy-exporter
|
||||||
- prometheus-cadvisor
|
- prometheus-cadvisor
|
||||||
|
- prometheus-alertmanager
|
||||||
|
- prometheus-openstack-exporter
|
||||||
- '&enable_prometheus_True'
|
- '&enable_prometheus_True'
|
||||||
serial: '{{ kolla_serial|default("0") }}'
|
serial: '{{ kolla_serial|default("0") }}'
|
||||||
roles:
|
roles:
|
||||||
|
@ -543,3 +543,4 @@ tempest_floating_network_name:
|
|||||||
#enable_prometheus_memcached: "{{ enable_prometheus | bool }}"
|
#enable_prometheus_memcached: "{{ enable_prometheus | bool }}"
|
||||||
#enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
|
#enable_prometheus_alertmanager: "{{ enable_prometheus | bool }}"
|
||||||
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
|
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
|
||||||
|
#enable_prometheus_openstack_exporter: "{{ enable_prometheus | bool }}"
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Deploys and configures the prometheus-openstack-exporter (https://github.com/Linaro/openstack-exporter/)
|
||||||
|
as part of the prometheus monitoring exporters stack.
|
@ -661,3 +661,6 @@ control
|
|||||||
compute
|
compute
|
||||||
network
|
network
|
||||||
storage
|
storage
|
||||||
|
|
||||||
|
[prometheus-openstack-exporter:children]
|
||||||
|
monitoring
|
||||||
|
Loading…
Reference in New Issue
Block a user