Manage Prometheus targets
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
979021f5c4
commit
2bafbeedd7
18
salt/profile/prometheus/targets.sls
Normal file
18
salt/profile/prometheus/targets.sls
Normal file
@ -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 %}
|
@ -1,2 +1,2 @@
|
||||
include:
|
||||
- .prometheus
|
||||
- prometheus.config
|
||||
|
@ -1,2 +1,2 @@
|
||||
include:
|
||||
- .prometheus
|
||||
- prometheus.config
|
||||
|
@ -1,2 +1,3 @@
|
||||
include:
|
||||
- prometheus.config
|
||||
- profile.prometheus.targets
|
||||
|
Loading…
Reference in New Issue
Block a user