diff --git a/grafana/meta/prometheus.yml b/grafana/meta/prometheus.yml new file mode 100644 index 0000000..b9c9fc9 --- /dev/null +++ b/grafana/meta/prometheus.yml @@ -0,0 +1,30 @@ +{%- if pillar.grafana.client is defined %} +{%- from "grafana/map.jinja" import client with context %} + +{%- if client.get('enabled') %} + +{%- set addresses = [] %} +{%- if not client.server.host.startswith('127') and client.server.host != '0.0.0.0' %} +{%- do addresses.append(client.server.host) %} +{%- endif %} +{%- for address in grains['fqdn_ip4'] %} +{%- if not address.startswith('127') %} +{%- do addresses.append(address) %} +{%- endif %} +{%- endfor %} +server: + target: + static: + grafana: + enabled: true + endpoint: + - address: {{ addresses[0] }} + port: {{ client.server.port }} + metric_relabel: + - source_labels: "__name__" + regex: "http_.*" + action: drop + +{%- endif %} + +{%- endif %} diff --git a/metadata/service/support.yml b/metadata/service/support.yml index 3bd2dd1..6437621 100644 --- a/metadata/service/support.yml +++ b/metadata/service/support.yml @@ -11,3 +11,5 @@ parameters: enabled: true grafana: enabled: true + prometheus: + enabled: true