Import moni Prometheus configuration #32
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
|
||||
Georg marked this conversation as resolved
|
||||
|
Loading…
Reference in New Issue
Block a user
I’m not sure if this ordering is alright - in case Prometheus needs a restart upon changes in the targets we might want to either move the profile.prometheus.targets include up here or move the include to the profile itself and add a
watch_in
to the states there.