Prometheus scrape ipmi collectors

This commit is contained in:
pz2891 2021-09-08 12:06:56 +02:00
parent a081468084
commit 57738cc725
3 changed files with 28 additions and 0 deletions

View file

@ -54,6 +54,9 @@
prometheus_targets: prometheus_targets:
- targets: | - targets: |
{{ groups['edc_pve'] + groups['edc_vm'] + groups['edc_server'] | list | sort }} {{ groups['edc_pve'] + groups['edc_vm'] + groups['edc_server'] | list | sort }}
prometheus_ipmi_targets:
- targets: |
{{ groups['edc_pve'] + groups['edc_server'] | list | sort }}
prometheus_unifi_snmp_targets: prometheus_unifi_snmp_targets:
- targets: "{{ groups['edc_unifi'] | list | sort }}" - targets: "{{ groups['edc_unifi'] | list | sort }}"
roles: roles:

View file

@ -113,6 +113,13 @@
mode: 0644 mode: 0644
when: prometheus_pdu_snmp_targets is defined when: prometheus_pdu_snmp_targets is defined
- name: Configure Prometheus ipmi targets monitoring
copy:
content: "{{ prometheus_ipmi_targets | to_nice_json }}\n"
dest: /etc/prometheus/targets_ipmi.json
mode: 0644
when: prometheus_ipmi_targets is defined
- name: Activate prometheus service - name: Activate prometheus service
systemd: systemd:
name: prometheus name: prometheus

View file

@ -140,4 +140,22 @@ scrape_configs:
- target_label: __address__ - target_label: __address__
replacement: 127.0.0.1:9116 replacement: 127.0.0.1:9116
- job_name: ipmi
file_sd_configs:
- files:
- '/etc/prometheus/targets_ipmi.json'
metrics_path: /metrics
params:
module: [default]
relabel_configs:
# Do not put :9290 in instance name, rather here
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- source_labels: [__param_target]
target_label: __address__
replacement: '$1:9290'
... ...