summaryrefslogtreecommitdiffstats
path: root/salt/profile/prometheus
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-02-15 20:59:46 +0100
committerGeorg Pfuetzenreuter2023-02-21 19:05:40 +0100
commit2bafbeedd72e4d3c02da56cf361f98e50382ce13 (patch)
tree3fb3eba3ccba9a986800e8f0deb351a565a1ecae /salt/profile/prometheus
parent979021f5c40c812d7a9edf22bf8945f691badeed (diff)
downloadsalt-2bafbeedd72e4d3c02da56cf361f98e50382ce13.tar.gz
salt-2bafbeedd72e4d3c02da56cf361f98e50382ce13.tar.bz2
salt-2bafbeedd72e4d3c02da56cf361f98e50382ce13.zip
Manage Prometheus targets
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'salt/profile/prometheus')
-rw-r--r--salt/profile/prometheus/targets.sls18
1 files changed, 18 insertions, 0 deletions
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 %}