summaryrefslogtreecommitdiffstats
path: root/salt/profile
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-02-25 16:47:21 +0100
committerGeorg Pfuetzenreuter2023-02-25 16:47:21 +0100
commitcc007e6470a54311fac2facd1c6e9b321a3a4f28 (patch)
tree4b5a33871977947b1ae94041dd6be49d1bc03991 /salt/profile
parentc8c91269fda61fcf37ce9cb821c0bd83d32125ab (diff)
parentddb72f1cb3e3b6b4dbe11ff36510bf15e226b9aa (diff)
downloadsalt-cc007e6470a54311fac2facd1c6e9b321a3a4f28.tar.gz
salt-cc007e6470a54311fac2facd1c6e9b321a3a4f28.tar.bz2
salt-cc007e6470a54311fac2facd1c6e9b321a3a4f28.zip
Merge pull request 'Import moni Prometheus configuration' (#32) from prometheus-moni into production
Reviewed-on: https://git.com.de/LibertaCasa/salt/pulls/32
Diffstat (limited to 'salt/profile')
-rw-r--r--salt/profile/prometheus/node_exporter.sls (renamed from salt/profile/node_exporter/init.sls)0
-rw-r--r--salt/profile/prometheus/targets.sls18
2 files changed, 18 insertions, 0 deletions
diff --git a/salt/profile/node_exporter/init.sls b/salt/profile/prometheus/node_exporter.sls
index 1e46b3d..1e46b3d 100644
--- a/salt/profile/node_exporter/init.sls
+++ b/salt/profile/prometheus/node_exporter.sls
diff --git a/salt/profile/prometheus/targets.sls b/salt/profile/prometheus/targets.sls
new file mode 100644
index 0000000..5f29e73
--- /dev/null
+++ b/salt/profile/prometheus/targets.sls
@@ -0,0 +1,18 @@
+{%- set mypillar = salt['pillar.get']('profile:prometheus:targets') %}
+{%- set targetsdir = '/etc/prometheus/targets' %}
+
+{%- if mypillar | length %}
+{{ targetsdir }}:
+ file.directory:
+ - group: prometheus
+
+{%- for group, nodes in mypillar.items() %}
+{{ targetsdir }}/{{ group }}.json:
+ file.serialize:
+ - dataset: {{ nodes }}
+ - serializer: json
+{%- endfor %}
+
+{%- else %}
+{%- do salt.log.debug('profile.prometheus: no targets defined') %}
+{%- endif %}