Import moni Prometheus configuration #32

Merged
Georg merged 6 commits from prometheus-moni into production 2023-02-25 16:47:21 +01:00
4 changed files with 21 additions and 2 deletions
Showing only changes of commit 2bafbeedd7 - Show all commits

View 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 %}

View File

@ -1,2 +1,2 @@
include:
- .prometheus
- prometheus.config

View File

@ -1,2 +1,2 @@
include:
- .prometheus
- prometheus.config

View File

@ -1,2 +1,3 @@
include:
- prometheus.config
- profile.prometheus.targets
Georg marked this conversation as resolved
Review

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.

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.