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

Add support for deploying Dell hardware exporter #23

Open
wants to merge 1 commit into
base: cumulus/rocky
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ prometheus_cadvisor_port: "18080"
prometheus_mtail_port: "9197"
prometheus_libvirt_exporter_port: "9177"
prometheus_jiralert_port: "9097"
prometheus_dellhw_exporter_port: "9137"

# Prometheus alertmanager ports
prometheus_alertmanager_port: "9093"
Expand Down Expand Up @@ -884,6 +885,9 @@ prometheus_jiralert_api_url:
prometheus_jiralert_user:
prometheus_jiralert_project:

# Prometheus Dell hardware exporter settings
enable_prometheus_dellhw_exporter: "no"

prometheus_alertmanager_user: "admin"
prometheus_openstack_exporter_interval: "60s"
prometheus_mtail_interval: "10s"
Expand Down
7 changes: 7 additions & 0 deletions ansible/inventory/all-in-one
Original file line number Diff line number Diff line change
Expand Up @@ -720,3 +720,10 @@ compute

[prometheus-jiralert:children]
prometheus-alertmanager

[prometheus-dellhw-exporter:children]
monitoring
control
compute
network
storage
7 changes: 7 additions & 0 deletions ansible/inventory/multinode
Original file line number Diff line number Diff line change
Expand Up @@ -739,3 +739,10 @@ compute

[prometheus-jiralert:children]
prometheus-alertmanager

[prometheus-dellhw-exporter:children]
monitoring
control
compute
network
storage
14 changes: 14 additions & 0 deletions ansible/roles/prometheus/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ prometheus_services:
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
dimensions: "{{ prometheus_jiralert_dimensions }}"
prometheus-dellhw-exporter:
container_name: "prometheus_dellhw_exporter"
group: "prometheus-dellhw-exporter"
enabled: "{{ enable_prometheus_dellhw_exporter | bool }}"
image: "{{ prometheus_dellhw_exporter_image_full }}"
volumes:
- "{{ node_config_directory }}/prometheus-dellhw-exporter/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
dimensions: "{{ prometheus_dellhw_exporter_dimensions }}"

####################
# Database
Expand Down Expand Up @@ -210,6 +219,10 @@ prometheus_jiralert_image: "{{ docker_registry ~ '/' if docker_registry else ''
prometheus_jiralert_tag: "{{ prometheus_tag }}"
prometheus_jiralert_image_full: "{{ prometheus_jiralert_image }}:{{ prometheus_jiralert_tag }}"

prometheus_hw_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-prometheus-dellhw-exporter"
prometheus_hw_exporter_tag: "{{ prometheus_tag }}"
prometheus_hw_exporter_image_full: "{{ prometheus_hw_exporter_image }}:{{ prometheus_dellhw_exporter_tag }}"

prometheus_server_dimensions: "{{ default_container_dimensions }}"
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
Expand All @@ -222,3 +235,4 @@ prometheus_mtail_dimensions: "{{ default_container_dimensions }}"
prometheus_elasticsearch_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_libvirt_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_jiralert_dimensions: "{{ default_container_dimensions }}"
prometheus_dellhw_exporter_dimensions: "{{ default_container_dimensions }}"
21 changes: 21 additions & 0 deletions ansible/roles/prometheus/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,24 @@
or prometheus_jiralert_confs.changed | bool
or prometheus_jiralert_template.changed | bool
or prometheus_container.changed | bool

- name: Restart prometheus-dellhw-exporter container
vars:
service_name: "prometheus-dellhw-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
15 changes: 15 additions & 0 deletions ansible/roles/prometheus/tasks/precheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- prometheus_elasticsearch_exporter
- prometheus_libvirt_exporter
- prometheus_jiralert
- prometheus_dellhw_exporter
register: container_facts

- name: Checking free port for Prometheus server
Expand Down Expand Up @@ -171,3 +172,17 @@
- enable_prometheus_jiralert | bool
with_items:
- "{{ prometheus_jiralert_port }}"

- name: Checking free ports for Prometheus dellhw-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_dellhw_exporter'] is not defined
- inventory_hostname in groups['prometheus-dellhw-exporter']
- enable_prometheus_dellhw_exporter | bool
with_items:
- "{{ prometheus_dellhw_exporter_port }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"command": "/opt/dellhw_exporter -web.listen-address {{ api_interface_address }}:{{ prometheus_dellhw_exporter_port }}",
"config_files": [],
"permissions": [
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
}
]
}
10 changes: 10 additions & 0 deletions ansible/roles/prometheus/templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,13 @@ alerting:
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
{% endfor %}
{% endif %}

{% if enable_prometheus_dellhw_exporter | bool %}
- job_name: dellhw_exporter
scrape_interval: {{ prometheus_dellhw_exporter_interval }}
static_configs:
- targets:
{% for host in groups["prometheus-dellhw-exporter"] %}
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_dellhw_exporter_port'] }}'
{% endfor %}
{% endif %}
1 change: 1 addition & 0 deletions ansible/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
- prometheus-mtail
- prometheus-elasticsearch-exporter
- prometheus-libvirt-exporter
- prometheus-dellhw-exporter
serial: '{{ kolla_serial|default("0") }}'
roles:
- { role: prometheus,
Expand Down
1 change: 1 addition & 0 deletions etc/kolla/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,4 @@ tempest_floating_network_name:
#enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool }}"
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
#enable_prometheus_jiralert: "{{ enable_prometheus | bool and enable_prometheus_jiralert | bool }}"
#enable_prometheus_dellhw_exporter: "no"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
Deploys and configures the prometheus-dellhw-exporter (https://github.com/galexrt/dellhw_exporter)
for monitoring Dell hardware.
7 changes: 7 additions & 0 deletions tests/templates/inventory.j2
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,10 @@ storage

[prometheus-elasticsearch-exporter:children]
elasticsearch

[prometheus-dellhw-exporter:children]
monitoring
control
compute
network
storage