summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-06-01 17:43:29 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-06-20 01:44:16 +0200
commitcff0e0a73e85f9c4bc89a481842fa5959d09a9b0 (patch)
tree1fd3a53bee1ba9fe1281e2a6823cbeb492b42e43 /roles
parentprometheus: initial node exporter role (diff)
prometheus: node exporter automatically select time-sync collector
Diffstat (limited to 'roles')
-rw-r--r--roles/monitoring/prometheus/exporter/node/defaults/main.yml11
-rw-r--r--roles/monitoring/prometheus/exporter/node/templates/service.j22
2 files changed, 10 insertions, 3 deletions
diff --git a/roles/monitoring/prometheus/exporter/node/defaults/main.yml b/roles/monitoring/prometheus/exporter/node/defaults/main.yml
index 5eff7844..56227fbb 100644
--- a/roles/monitoring/prometheus/exporter/node/defaults/main.yml
+++ b/roles/monitoring/prometheus/exporter/node/defaults/main.yml
@@ -1,5 +1,12 @@
---
-prometheus_exporter_node_disable_collectors: []
+_prometheus_exporter_node_time_collector_map_:
+ "": timex
+ systemd-timesyncd: timex
+ chrony: ntp
+ openntpd: ntp
+
+prometheus_exporter_node_timesync_collector: "{{ _prometheus_exporter_node_time_collector_map_[ntp_variant | default('')] }}"
+prometheus_exporter_node_disable_collectors: []
prometheus_exporter_node_extra_collectors:
-- ntp
+- "{{ prometheus_exporter_node_timesync_collector }}"
diff --git a/roles/monitoring/prometheus/exporter/node/templates/service.j2 b/roles/monitoring/prometheus/exporter/node/templates/service.j2
index c3b46472..801850ed 100644
--- a/roles/monitoring/prometheus/exporter/node/templates/service.j2
+++ b/roles/monitoring/prometheus/exporter/node/templates/service.j2
@@ -4,7 +4,7 @@ Description=Prometheus exporter
[Service]
Restart=always
User=prometheus-exporter
-ExecStart=/usr/bin/prometheus-node-exporter --web.listen-address="127.0.0.1:9100" --web.disable-exporter-metrics --collector.textfile.directory="/var/lib/prometheus-node-exporter/textfile-collector" {% for collector in prometheus_exporter_node_disable_collectors %} --no-collector.{{ collector }}{% endfor %}{% for collector in prometheus_exporter_node_extra_collectors %} --collector.{{ collector }}{% endfor %}{{ '' }}
+ExecStart=/usr/bin/prometheus-node-exporter --web.listen-address="127.0.0.1:9100" --web.disable-exporter-metrics --collector.textfile.directory="/var/lib/prometheus-node-exporter/textfile-collector"{% for collector in prometheus_exporter_node_disable_collectors %} --no-collector.{{ collector }}{% endfor %}{% for collector in prometheus_exporter_node_extra_collectors %} --collector.{{ collector }}{% endfor %}{{ '' }}
[Install]
WantedBy=multi-user.target