summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-07-28 13:50:00 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-07-28 13:50:00 +0200
commit312c81d93d087642979939f37d20c64527d7ad82 (patch)
treedc1e2ca613acc032a38a7462bebe2020cfbd9429 /roles
parentadd nut aka UPS to prometheus monitoring (diff)
promehteus nut exporter: make exported variables and statuses configureable
Diffstat (limited to 'roles')
-rw-r--r--roles/monitoring/prometheus/exporter/nut/defaults/main.yml28
-rw-r--r--roles/monitoring/prometheus/exporter/nut/templates/service.j22
2 files changed, 29 insertions, 1 deletions
diff --git a/roles/monitoring/prometheus/exporter/nut/defaults/main.yml b/roles/monitoring/prometheus/exporter/nut/defaults/main.yml
new file mode 100644
index 00000000..e358627c
--- /dev/null
+++ b/roles/monitoring/prometheus/exporter/nut/defaults/main.yml
@@ -0,0 +1,28 @@
+---
+prometheus_exporter_nut_variables:
+ - "battery.charge"
+ - "battery.runtime"
+ - "battery.voltage"
+ - "battery.voltage.nominal"
+ - "input.frequency"
+ - "input.frequency.nominal"
+ - "input.voltage"
+ - "input.voltage.nominal"
+ - "output.frequency"
+ - "output.frequency.nominal"
+ - "output.voltage"
+ - "output.voltage.nominal"
+ - "ups.load"
+ - "ups.power"
+ - "ups.power.nominal"
+ - "ups.realpower"
+ - "ups.realpower.nominal"
+ - "ups.status"
+
+prometheus_exporter_nut_statuses:
+ - "OL"
+ - "OB"
+ - "LB"
+ - "RB"
+ - "OFF"
+ - "OVER"
diff --git a/roles/monitoring/prometheus/exporter/nut/templates/service.j2 b/roles/monitoring/prometheus/exporter/nut/templates/service.j2
index ffafcb3c..99613f50 100644
--- a/roles/monitoring/prometheus/exporter/nut/templates/service.j2
+++ b/roles/monitoring/prometheus/exporter/nut/templates/service.j2
@@ -4,7 +4,7 @@ Description=Prometheus nut exporter
[Service]
Restart=always
User=prometheus-exporter
-ExecStart=/usr/bin/prometheus-nut-exporter --web.listen-address="127.0.0.1:9199"
+ExecStart=/usr/bin/prometheus-nut-exporter --web.listen-address="127.0.0.1:9199" --nut.vars_enable="{{ prometheus_exporter_nut_variables | join(',') }}" --nut.statuses="{{ prometheus_exporter_nut_statuses | join(',') }}"
# systemd hardening-options
AmbientCapabilities=