Skip to content

Commit a0fb0d4

Browse files
committed
Add support for deploying Dell hardware exporter
Deploys and configures the prometheus-dellhw-exporter (https://github.com/galexrt/dellhw_exporter) from monitoring Dell hardware.
1 parent ec79ea1 commit a0fb0d4

12 files changed

Lines changed: 103 additions & 0 deletions

File tree

ansible/group_vars/all.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ prometheus_cadvisor_port: "18080"
293293
prometheus_mtail_port: "9197"
294294
prometheus_libvirt_exporter_port: "9177"
295295
prometheus_jiralert_port: "9097"
296+
prometheus_dellhw_exporter_port: "9137"
296297

297298
# Prometheus alertmanager ports
298299
prometheus_alertmanager_port: "9093"
@@ -884,6 +885,9 @@ prometheus_jiralert_api_url:
884885
prometheus_jiralert_user:
885886
prometheus_jiralert_project:
886887

888+
# Prometheus Dell hardware exporter settings
889+
enable_prometheus_dellhw_exporter: "no"
890+
887891
prometheus_alertmanager_user: "admin"
888892
prometheus_openstack_exporter_interval: "60s"
889893
prometheus_mtail_interval: "10s"

ansible/inventory/all-in-one

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,3 +720,10 @@ compute
720720

721721
[prometheus-jiralert:children]
722722
prometheus-alertmanager
723+
724+
[prometheus-dellhw-exporter:children]
725+
monitoring
726+
control
727+
compute
728+
network
729+
storage

ansible/inventory/multinode

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,3 +739,10 @@ compute
739739

740740
[prometheus-jiralert:children]
741741
prometheus-alertmanager
742+
743+
[prometheus-dellhw-exporter:children]
744+
monitoring
745+
control
746+
compute
747+
network
748+
storage

ansible/roles/prometheus/defaults/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,15 @@ prometheus_services:
136136
- "/etc/localtime:/etc/localtime:ro"
137137
- "kolla_logs:/var/log/kolla/"
138138
dimensions: "{{ prometheus_jiralert_dimensions }}"
139+
prometheus-dellhw-exporter:
140+
container_name: "prometheus_dellhw_exporter"
141+
group: "prometheus-dellhw-exporter"
142+
enabled: "{{ enable_prometheus_dellhw_exporter | bool }}"
143+
image: "{{ prometheus_dellhw_exporter_image_full }}"
144+
volumes:
145+
- "{{ node_config_directory }}/prometheus-dellhw-exporter/:{{ container_config_directory }}/:ro"
146+
- "/etc/localtime:/etc/localtime:ro"
147+
dimensions: "{{ prometheus_dellhw_exporter_dimensions }}"
139148

140149
####################
141150
# Database
@@ -210,6 +219,10 @@ prometheus_jiralert_image: "{{ docker_registry ~ '/' if docker_registry else ''
210219
prometheus_jiralert_tag: "{{ prometheus_tag }}"
211220
prometheus_jiralert_image_full: "{{ prometheus_jiralert_image }}:{{ prometheus_jiralert_tag }}"
212221

222+
prometheus_hw_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-prometheus-dellhw-exporter"
223+
prometheus_hw_exporter_tag: "{{ prometheus_tag }}"
224+
prometheus_hw_exporter_image_full: "{{ prometheus_hw_exporter_image }}:{{ prometheus_dellhw_exporter_tag }}"
225+
213226
prometheus_server_dimensions: "{{ default_container_dimensions }}"
214227
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
215228
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
@@ -222,3 +235,4 @@ prometheus_mtail_dimensions: "{{ default_container_dimensions }}"
222235
prometheus_elasticsearch_exporter_dimensions: "{{ default_container_dimensions }}"
223236
prometheus_libvirt_exporter_dimensions: "{{ default_container_dimensions }}"
224237
prometheus_jiralert_dimensions: "{{ default_container_dimensions }}"
238+
prometheus_dellhw_exporter_dimensions: "{{ default_container_dimensions }}"

ansible/roles/prometheus/handlers/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,24 @@
256256
or prometheus_jiralert_confs.changed | bool
257257
or prometheus_jiralert_template.changed | bool
258258
or prometheus_container.changed | bool
259+
260+
- name: Restart prometheus-dellhw-exporter container
261+
vars:
262+
service_name: "prometheus-dellhw-exporter"
263+
service: "{{ prometheus_services[service_name] }}"
264+
config_json: "{{ prometheus_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
265+
prometheus_container: "{{ check_prometheus_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
266+
become: true
267+
kolla_docker:
268+
action: "recreate_or_restart_container"
269+
common_options: "{{ docker_common_options }}"
270+
name: "{{ service.container_name }}"
271+
image: "{{ service.image }}"
272+
volumes: "{{ service.volumes }}"
273+
dimensions: "{{ service.dimensions }}"
274+
when:
275+
- kolla_action != "config"
276+
- inventory_hostname in groups[service.group]
277+
- service.enabled | bool
278+
- config_json.changed | bool
279+
or prometheus_container.changed | bool

ansible/roles/prometheus/tasks/precheck.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- prometheus_elasticsearch_exporter
1515
- prometheus_libvirt_exporter
1616
- prometheus_jiralert
17+
- prometheus_dellhw_exporter
1718
register: container_facts
1819

1920
- name: Checking free port for Prometheus server
@@ -171,3 +172,17 @@
171172
- enable_prometheus_jiralert | bool
172173
with_items:
173174
- "{{ prometheus_jiralert_port }}"
175+
176+
- name: Checking free ports for Prometheus dellhw-exporter
177+
wait_for:
178+
host: "{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}"
179+
port: "{{ item }}"
180+
connect_timeout: 1
181+
timeout: 1
182+
state: stopped
183+
when:
184+
- container_facts['prometheus_dellhw_exporter'] is not defined
185+
- inventory_hostname in groups['prometheus-dellhw-exporter']
186+
- enable_prometheus_dellhw_exporter | bool
187+
with_items:
188+
- "{{ prometheus_dellhw_exporter_port }}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"command": "/opt/dellhw_exporter -web.listen-address {{ api_interface_address }}:{{ prometheus_dellhw_exporter_port }}",
3+
"config_files": [],
4+
"permissions": [
5+
{
6+
"path": "/var/log/kolla/prometheus",
7+
"owner": "prometheus:kolla",
8+
"recurse": true
9+
}
10+
]
11+
}

ansible/roles/prometheus/templates/prometheus.yml.j2

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,13 @@ alerting:
122122
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_alertmanager_port'] }}'
123123
{% endfor %}
124124
{% endif %}
125+
126+
{% if enable_prometheus_dellhw_exporter | bool %}
127+
- job_name: dellhw_exporter
128+
scrape_interval: {{ prometheus_dellhw_exporter_interval }}
129+
static_configs:
130+
- targets:
131+
{% for host in groups["prometheus-dellhw-exporter"] %}
132+
- '{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ hostvars[host]['prometheus_dellhw_exporter_port'] }}'
133+
{% endfor %}
134+
{% endif %}

ansible/site.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
- prometheus-mtail
141141
- prometheus-elasticsearch-exporter
142142
- prometheus-libvirt-exporter
143+
- prometheus-dellhw-exporter
143144
serial: '{{ kolla_serial|default("0") }}'
144145
roles:
145146
- { role: prometheus,

etc/kolla/globals.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,4 @@ tempest_floating_network_name:
510510
#enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool }}"
511511
#enable_prometheus_ceph_mgr_exporter: "{{ enable_prometheus | bool and enable_ceph | bool }}"
512512
#enable_prometheus_jiralert: "{{ enable_prometheus | bool and enable_prometheus_jiralert | bool }}"
513+
#enable_prometheus_dellhw_exporter: "no"

0 commit comments

Comments
 (0)