[prometheus] Enable ceph mgr exporter

This patch enables the ceph mgr prometheus exporter.

If enable_prometheus_ceph_mgr_exporter is set to true,
the ceph mgr prometheus plugin is enabled on the hosts that are part
of the ceph-mgr group, then the exporter is added into the prometheus-server
configuration file.

Change-Id: Ia2f879401e585e6043f69cc5e3ab1a1f72f7f033
This commit is contained in:
Jorge Niedbalski 2018-06-11 11:10:12 -04:00 committed by Jeffrey Zhang
parent f7101cd41b
commit 9d2770db11
5 changed files with 25 additions and 0 deletions

View File

@ -280,6 +280,7 @@ prometheus_node_exporter_port: "9100"
prometheus_mysqld_exporter_port: "9104" prometheus_mysqld_exporter_port: "9104"
prometheus_haproxy_exporter_port: "9101" prometheus_haproxy_exporter_port: "9101"
prometheus_memcached_exporter_port: "9150" prometheus_memcached_exporter_port: "9150"
prometheus_ceph_mgr_exporter_port: "9283"
# Default cadvisor port of 8080 already in use # Default cadvisor port of 8080 already in use
prometheus_cadvisor_port: "18080" prometheus_cadvisor_port: "18080"
@ -849,4 +850,5 @@ enable_prometheus_node_exporter: "{{ enable_prometheus | bool }}"
enable_prometheus_memcached_exporter: "{{ enable_memcached | bool }}" 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 }}"
prometheus_alertmanager_user: "admin" prometheus_alertmanager_user: "admin"

View File

@ -31,3 +31,9 @@
- "{{ node_config_directory }}/ceph-mgr/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/ceph-mgr/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla" - "kolla_logs:/var/log/kolla"
- name: Enable the ceph mgr prometheus module
command: docker exec ceph_mgr ceph mgr module enable prometheus
when:
- inventory_hostname in groups['ceph-mgr']
- enable_prometheus_ceph_mgr_exporter | bool

View File

@ -58,6 +58,16 @@ scrape_configs:
{% endfor %} {% endfor %}
{% endif %} {% 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_alertmanager | bool %} {% if enable_prometheus_alertmanager | bool %}
alerting: alerting:
alertmanagers: alertmanagers:

View File

@ -500,3 +500,4 @@ tempest_floating_network_name:
#enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}" #enable_prometheus_cadvisor: "{{ enable_prometheus | bool }}"
#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 }}"

View File

@ -0,0 +1,6 @@
---
features:
- |
Exposed a config option to enable the ceph manager prometheus
plugin, this also enables the exporter on the prometheus-server
configuration for each ceph-mgr host.