WIP: prometheus-ipmi-exporter #63
5 changed files with 87 additions and 0 deletions
|
@ -180,6 +180,11 @@
|
||||||
roles:
|
roles:
|
||||||
- prometheus_postgres
|
- prometheus_postgres
|
||||||
|
|
||||||
|
# IPMI Exporters
|
||||||
|
- hosts: server,pve
|
||||||
|
roles:
|
||||||
|
- prometheus_ipmi
|
||||||
|
|
||||||
|
|
||||||
# Monitor all hosts
|
# Monitor all hosts
|
||||||
- hosts: all,!edc_unifi,!fleming_unifi,!pacaterie_unifi,!gs_unifi,!rives_unifi,!aurore_testing_vm,!ovh_container
|
- hosts: all,!edc_unifi,!fleming_unifi,!pacaterie_unifi,!gs_unifi,!rives_unifi,!aurore_testing_vm,!ovh_container
|
||||||
|
|
3
roles/prometheus_ipmi/files/ipmi_conf/ipmi.sh
Executable file
3
roles/prometheus_ipmi/files/ipmi_conf/ipmi.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
sudo /usr/sbin/$(basename $0) "$@"
|
||||||
|
|
9
roles/prometheus_ipmi/files/prometheus
Normal file
9
roles/prometheus_ipmi/files/prometheus
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Prometheus can be sudo for ipmi collector
|
||||||
|
|
||||||
|
prometheus ALL = NOPASSWD: /usr/sbin/ipmimonitoring,\
|
||||||
|
/usr/sbin/ipmi-sensors,\
|
||||||
|
/usr/sbin/ipmi-dcmi,\
|
||||||
|
/usr/sbin/ipmi-raw,\
|
||||||
|
/usr/sbin/bmc-info,\
|
||||||
|
/usr/sbin/ipmi-chassis,\
|
||||||
|
/usr/sbin/ipmi-sel
|
6
roles/prometheus_ipmi/handlers/main.yml
Normal file
6
roles/prometheus_ipmi/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: Restart prometheus-ipmi-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-ipmi-exporter
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: yes
|
64
roles/prometheus_ipmi/tasks/main.yml
Normal file
64
roles/prometheus_ipmi/tasks/main.yml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
---
|
||||||
|
- name: Install Prometheus ipmi-exporter
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
name: prometheus-ipmi-exporter
|
||||||
|
register: apt_result
|
||||||
|
retries: 3
|
||||||
|
until: apt_result is succeeded
|
||||||
|
|
||||||
|
- name: Make Prometheus ipmi-exporter scrap on localhost only
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/default/prometheus-ipmi-exporter
|
||||||
|
regexp: '^ARGS='
|
||||||
|
line: |
|
||||||
|
ARGS="--config.file=/etc/prometheus/ipmi_local.yml --freeipmi.path='/etc/prometheus/ipmi_conf/'"
|
||||||
|
notify: Restart prometheus-ipmi-exporter
|
||||||
|
|
||||||
|
- name: Define prometheus to be sudo for some command
|
||||||
|
copy:
|
||||||
|
src: files/prometheus
|
||||||
|
dest: /etc/sudoers.d/prometheus
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=r,g=r,o=
|
||||||
|
notify: Restart prometheus-ipmi-exporter
|
||||||
|
|
||||||
|
- name: Override commands launchs by prometheus for ipmi
|
||||||
|
copy:
|
||||||
|
src: files/ipmi_conf
|
||||||
|
dest: /etc/prometheus
|
||||||
|
owner: prometheus
|
||||||
|
group: prometheus
|
||||||
|
mode: u=rx,g=r,o=
|
||||||
|
notify: Restart prometheus-ipmi-exporter
|
||||||
|
|
||||||
|
- name: Override commands launchs by prometheus for ipmi
|
||||||
|
file:
|
||||||
|
src: '/etc/prometheus/ipmi_conf/ipmi.sh'
|
||||||
|
dest: '/etc/prometheus/ipmi_conf/{{ item }}'
|
||||||
|
state: link
|
||||||
|
force: yes
|
||||||
|
owner: prometheus
|
||||||
|
group: prometheus
|
||||||
|
mode: u=rx,g=,o=
|
||||||
|
loop:
|
||||||
|
- bmc-info
|
||||||
|
- ipmi-chassis
|
||||||
|
- ipmi-dcmi
|
||||||
|
- ipmimonitoring
|
||||||
|
- ipmi-raw
|
||||||
|
- ipmi-sensors
|
||||||
|
notify: Restart prometheus-ipmi-exporter
|
||||||
|
|
||||||
|
- name: Activate prometheus-ipmi-exporter service
|
||||||
|
systemd:
|
||||||
|
name: prometheus-ipmi-exporter
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
|
||||||
|
- name: Restart prometheus-ipmi-exporter
|
||||||
|
systemd:
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: yes
|
||||||
|
name: prometheus-ipmi-exporter
|
Loading…
Reference in a new issue