Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate IRIS and stackhpc branches #160

Open
wants to merge 6 commits into
base: stackhpc/victoria
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ placement_api_port: "8780"
placement_api_listen_port: "{{ placement_api_port }}"

prometheus_port: "9091"
prometheus_libvirt_exporter_port: "9177"
prometheus_node_exporter_port: "9100"
prometheus_mysqld_exporter_port: "9104"
prometheus_haproxy_exporter_port: "9101"
Expand Down Expand Up @@ -1115,6 +1116,7 @@ use_common_mariadb_user: "no"
# Prometheus
############
enable_prometheus_server: "{{ enable_prometheus | bool }}"
enable_prometheus_libvirt_exporter: "no"
enable_prometheus_haproxy_exporter: "{{ enable_haproxy | bool }}"
enable_prometheus_mysqld_exporter: "{{ enable_mariadb | bool }}"
enable_prometheus_node_exporter: "{{ enable_prometheus | bool }}"
Expand All @@ -1128,6 +1130,7 @@ enable_prometheus_blackbox_exporter: "{{ enable_prometheus | bool }}"
enable_prometheus_rabbitmq_exporter: "{{ enable_prometheus | bool and enable_rabbitmq | bool }}"

prometheus_alertmanager_user: "admin"
prometheus_libvirt_exporter_interval: "60s"
prometheus_openstack_exporter_interval: "60s"
prometheus_openstack_exporter_timeout: "10s"
prometheus_elasticsearch_exporter_interval: "60s"
Expand Down
3 changes: 3 additions & 0 deletions ansible/inventory/all-in-one
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ compute
network
storage

[prometheus-libvirt-exporter:children]
compute

[prometheus-mysqld-exporter:children]
mariadb

Expand Down
3 changes: 3 additions & 0 deletions ansible/inventory/multinode
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ compute
network
storage

[prometheus-libvirt-exporter:children]
compute

[prometheus-mysqld-exporter:children]
mariadb

Expand Down
1 change: 1 addition & 0 deletions ansible/roles/nova-cell/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ nova_libvirt_default_volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup"
- "kolla_logs:/var/log/kolla/"
- "libvirtd:/var/lib/libvirt"
- "{% if enable_prometheus_libvirt_exporter | bool %}libvirtd_run:/var/run/libvirt{% endif %}"
- "{{ nova_instance_datadir_volume }}:/var/lib/nova/"
- "{% if enable_shared_var_lib_nova_mnt | bool %}/var/lib/nova/mnt:/var/lib/nova/mnt:shared{% endif %}"
- "nova_libvirt_qemu:/etc/libvirt/qemu"
Expand Down
17 changes: 17 additions & 0 deletions ansible/roles/prometheus/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ prometheus_services:
pid_mode: "host"
volumes: "{{ prometheus_node_exporter_default_volumes + prometheus_node_exporter_extra_volumes }}"
dimensions: "{{ prometheus_node_exporter_dimensions }}"
prometheus-libvirt-exporter:
container_name: "prometheus_libvirt_exporter"
group: "prometheus-libvirt-exporter"
enabled: "{{ enable_prometheus_libvirt_exporter | bool }}"
image: "{{ prometheus_libvirt_exporter_image_full }}"
volumes: "{{ prometheus_libvirt_exporter_default_volumes + prometheus_libvirt_exporter_extra_volumes }}"
dimensions: "{{ prometheus_libvirt_exporter_dimensions }}"
prometheus-mysqld-exporter:
container_name: prometheus_mysqld_exporter
group: prometheus-mysqld-exporter
Expand Down Expand Up @@ -121,6 +128,10 @@ prometheus_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}
prometheus_server_tag: "{{ prometheus_tag }}"
prometheus_server_image_full: "{{ prometheus_server_image }}:{{ prometheus_server_tag }}"

prometheus_libvirt_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-libvirt-exporter"
prometheus_libvirt_exporter_tag: "{{ prometheus_tag }}"
prometheus_libvirt_exporter_image_full: "{{ prometheus_libvirt_exporter_image }}:{{ prometheus_libvirt_exporter_tag }}"

prometheus_haproxy_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-haproxy-exporter"
prometheus_haproxy_exporter_tag: "{{ prometheus_tag }}"
prometheus_haproxy_exporter_image_full: "{{ prometheus_haproxy_exporter_image }}:{{ prometheus_haproxy_exporter_tag }}"
Expand Down Expand Up @@ -159,6 +170,7 @@ prometheus_blackbox_exporter_tag: "{{ prometheus_tag }}"
prometheus_blackbox_exporter_image_full: "{{ prometheus_blackbox_exporter_image }}:{{ prometheus_blackbox_exporter_tag }}"

prometheus_server_dimensions: "{{ default_container_dimensions }}"
prometheus_libvirt_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_node_exporter_dimensions: "{{ default_container_dimensions }}"
Expand All @@ -175,6 +187,10 @@ prometheus_server_default_volumes:
- "{{ '/etc/timezone:/etc/timezone:ro' if ansible_facts.os_family == 'Debian' else '' }}"
- "prometheus:/var/lib/prometheus"
- "kolla_logs:/var/log/kolla/"
prometheus_libvirt_exporter_default_volumes:
- "{{ node_config_directory }}/prometheus-libvirt-exporter/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "libvirtd_run:/var/run/libvirt:ro"
prometheus_haproxy_exporter_default_volumes:
- "{{ node_config_directory }}/prometheus-haproxy-exporter/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
Expand Down Expand Up @@ -231,6 +247,7 @@ prometheus_blackbox_exporter_default_volumes:
- "kolla_logs:/var/log/kolla/"

prometheus_extra_volumes: "{{ default_extra_volumes }}"
prometheus_libvirt_exporter_extra_volumes: "{{ prometheus_extra_volumes }}"
prometheus_server_extra_volumes: "{{ prometheus_extra_volumes }}"
prometheus_haproxy_exporter_extra_volumes: "{{ prometheus_extra_volumes }}"
prometheus_mysqld_exporter_extra_volumes: "{{ prometheus_extra_volumes }}"
Expand Down
15 changes: 15 additions & 0 deletions ansible/roles/prometheus/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,18 @@
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"

- name: Restart prometheus-libvirt-exporter container
vars:
service_name: "prometheus-libvirt-exporter"
service: "{{ prometheus_services[service_name] }}"
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"
15 changes: 15 additions & 0 deletions ansible/roles/prometheus/tasks/precheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- prometheus_openstack_exporter
- prometheus_elasticsearch_exporter
- prometheus_blackbox_exporter
- prometheus_libvirt_exporter
register: container_facts

- name: Checking free port for Prometheus server
Expand Down Expand Up @@ -149,3 +150,17 @@
- enable_prometheus_blackbox_exporter | bool
with_items:
- "{{ prometheus_blackbox_exporter_port }}"

- name: Checking free ports for Prometheus libvirt-exporter
wait_for:
host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'api' | kolla_address

port: "{{ item }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- container_facts['prometheus_libvirt_exporter'] is not defined
- inventory_hostname in groups['prometheus-libvirt-exporter']
- enable_prometheus_libvirt_exporter | bool
with_items:
- "{{ prometheus_libvirt_exporter_port }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"command": "/opt/libvirt_exporter --web.listen-address={{ api_interface_address }}:{{ prometheus_libvirt_exporter_port }}",
"config_files": []
}
11 changes: 11 additions & 0 deletions ansible/roles/prometheus/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ scrape_configs:
replacement: '{{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_blackbox_exporter_port }}'
{% endif %}


{% if enable_prometheus_libvirt_exporter | bool %}
- job_name: libvirt_exporter
scrape_interval: {{ prometheus_libvirt_exporter_interval }}
static_configs:
- targets:
{% for host in groups["prometheus-libvirt-exporter"] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_libvirt_exporter_port'] }}'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- '{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ hostvars[host]['prometheus_libvirt_exporter_port'] }}'

{% endfor %}
{% endif %}

{% if enable_prometheus_alertmanager | bool %}
- job_name: alertmanager
static_configs:
Expand Down
1 change: 1 addition & 0 deletions etc/kolla/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@
# Prometheus
############
#enable_prometheus_server: "{{ enable_prometheus | bool }}"
#enable_prometheus_libvirt_exporter: "no"
#enable_prometheus_haproxy_exporter: "{{ enable_haproxy | bool }}"
#enable_prometheus_mysqld_exporter: "{{ enable_mariadb | bool }}"
#enable_prometheus_node_exporter: "{{ enable_prometheus | bool }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
features:
- |
Deploys and configures the prometheus-libvirt-exporter image as
(https://github.com/kumina/libvirt_exporter) as part of the
Prometheus monitoring stack.
upgrade:
- |
The libvirt sockets in the Nova libvirt container have been moved to a
docker volume to support monitoring of libvirt. As part of this upgrade
the Nova libvirt containers will be restarted. This will affect users
of instances running in those containers.