Merge "[prometheus] Support the prometheus openstack exporter"
This commit is contained in:
commit
67d496b0e6
@ -304,6 +304,10 @@ prometheus_cadvisor_port: "18080"
|
||||
# Prometheus alertmanager ports
|
||||
prometheus_alertmanager_port: "9093"
|
||||
prometheus_alertmanager_cluster_port: "9094"
|
||||
|
||||
# Prometheus openstack-exporter ports
|
||||
prometheus_openstack_exporter_port: "9198"
|
||||
|
||||
qdrouterd_port: "31459"
|
||||
|
||||
rabbitmq_port: "5672"
|
||||
@ -924,7 +928,10 @@ enable_prometheus_memcached_exporter: "{{ enable_memcached | bool }}"
|
||||
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 }}"
|
||||
|
||||
prometheus_alertmanager_user: "admin"
|
||||
prometheus_openstack_exporter_interval: "60s"
|
||||
|
||||
############
|
||||
# Vitrage
|
||||
|
@ -729,3 +729,6 @@ storage
|
||||
|
||||
[prometheus-alertmanager:children]
|
||||
monitoring
|
||||
|
||||
[prometheus-openstack-exporter:children]
|
||||
monitoring
|
||||
|
@ -748,3 +748,6 @@ storage
|
||||
|
||||
[prometheus-alertmanager:children]
|
||||
monitoring
|
||||
|
||||
[prometheus-openstack-exporter:children]
|
||||
monitoring
|
||||
|
@ -104,6 +104,17 @@ prometheus_services:
|
||||
port: "{{ prometheus_alertmanager_port }}"
|
||||
auth_user: "{{ prometheus_alertmanager_user }}"
|
||||
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
|
||||
@ -144,6 +155,10 @@ prometheus_alertmanager_image: "{{ docker_registry ~ '/' if docker_registry else
|
||||
prometheus_alertmanager_tag: "{{ openstack_release }}"
|
||||
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_haproxy_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_cadvisor_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
|
||||
or prometheus_alertmanager_confs.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:
|
||||
- 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
|
||||
become: true
|
||||
kolla_docker:
|
||||
|
@ -9,6 +9,7 @@
|
||||
- prometheus_mysqld_exporter
|
||||
- prometheus_cadvisor
|
||||
- prometheus_alertmanager
|
||||
- prometheus_openstack_exporter
|
||||
register: container_facts
|
||||
|
||||
- name: Checking free port for Prometheus server
|
||||
@ -96,3 +97,17 @@
|
||||
with_items:
|
||||
- "{{ prometheus_alertmanager_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 %}
|
||||
{% 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 %}
|
||||
alerting:
|
||||
alertmanagers:
|
||||
|
@ -464,6 +464,8 @@
|
||||
- prometheus-mysqld-exporter
|
||||
- prometheus-haproxy-exporter
|
||||
- prometheus-cadvisor
|
||||
- prometheus-alertmanager
|
||||
- prometheus-openstack-exporter
|
||||
- '&enable_prometheus_True'
|
||||
serial: '{{ kolla_serial|default("0") }}'
|
||||
roles:
|
||||
|
@ -543,3 +543,4 @@ tempest_floating_network_name:
|
||||
#enable_prometheus_memcached: "{{ enable_prometheus | bool }}"
|
||||
#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 }}"
|
||||
|
@ -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.
|
@ -658,3 +658,6 @@ control
|
||||
compute
|
||||
network
|
||||
storage
|
||||
|
||||
[prometheus-openstack-exporter:children]
|
||||
monitoring
|
||||
|
Loading…
Reference in New Issue
Block a user