2017-05-11 16:12:31 -04:00
|
|
|
{%- if pillar.get('grafana', {}).get('collector') %}
|
2017-05-03 09:21:43 -04:00
|
|
|
{%- if pillar.grafana.collector.get('enabled', False) %}
|
|
|
|
{%- set service_grains = {} %}
|
|
|
|
{%- for service_name, service in pillar.iteritems() %}
|
|
|
|
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
|
|
|
|
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
|
|
|
|
{%- set grains_fragment_file = service_name+'/meta/grafana.yml' %}
|
|
|
|
{%- set grains_yaml = load_grains_file(grains_fragment_file)|load_yaml %}
|
|
|
|
{%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge=grains_yaml) %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
2017-04-29 03:37:32 -04:00
|
|
|
grain:
|
|
|
|
grafana:
|
2017-05-11 05:31:11 -04:00
|
|
|
grafana:
|
|
|
|
{{ service_grains|yaml(False)|indent(6) }}
|
2017-04-29 03:37:32 -04:00
|
|
|
{%- endif %}
|
2017-05-03 09:21:43 -04:00
|
|
|
{%- endif %}
|
2017-05-03 09:10:41 -04:00
|
|
|
|
|
|
|
minion:
|
2018-07-19 05:41:02 -04:00
|
|
|
{%- if pillar.get('grafana', {}).client is defined %}
|
2017-05-03 09:10:41 -04:00
|
|
|
grafana:
|
|
|
|
{%- from "grafana/map.jinja" import client with context %}
|
|
|
|
grafana_version: {{ client.server.get('version', 3) }}
|
|
|
|
grafana:
|
|
|
|
grafana_timeout: 3
|
|
|
|
{%- if client.server.token is defined %}
|
|
|
|
grafana_token: {{ client.server.token }}
|
|
|
|
{%- else %}
|
|
|
|
grafana_user: {{ client.server.user }}
|
|
|
|
grafana_password: {{ client.server.password }}
|
|
|
|
{%- endif %}
|
|
|
|
grafana_url: '{{ client.server.get('protocol', 'http') }}://{{ client.server.host }}:{{ client.server.get('port', 80) }}'
|
|
|
|
{%- endif %}
|