summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/nut/tasks/main.yml
blob: f602472d550c80176e99dce4b8efa8efbca53feb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
  ## TODO: pin version
- name: install apt packages
  apt:
    name: prom-exporter-nut
    state: present

- name: generate systemd service unit
  template:
    src: service.j2
    dest: /etc/systemd/system/prometheus-nut-exporter.service
  notify: restart prometheus-nut-exporter

- name: make sure prometheus-nut-exporter is enabled and started
  systemd:
    name: prometheus-nut-exporter.service
    daemon_reload: yes
    state: started
    enabled: yes

- name: register exporter
  copy:
    content: |
      location = /nut {
          proxy_pass http://127.0.0.1:9199/metrics;
      }
      location = /nut/ups {
          proxy_pass http://127.0.0.1:9199/ups_metrics;
      }
    dest: /etc/prometheus/exporter/nut.locations
  notify: reload nginx