From 520c9c6ebfbd06e025621e468a26d31e1f7c2a0b Mon Sep 17 00:00:00 2001 From: Mateusz Matuszkowiak Date: Thu, 14 Jun 2018 20:24:29 +0200 Subject: [PATCH] Added new container for prometheus to gainsight Change-Id: I28c88a10537a2b4aee235501b3854e52a10c7ab8 Related-Bug: PROD-19567 --- metadata/service/gainsight/container.yml | 8 ++++++++ prometheus/files/gainsight.yml | 5 +++++ prometheus/gainsight.sls | 18 ++++++++++++++++++ prometheus/map.jinja | 7 +++++++ 4 files changed, 38 insertions(+) create mode 100644 metadata/service/gainsight/container.yml create mode 100644 prometheus/files/gainsight.yml create mode 100644 prometheus/gainsight.sls diff --git a/metadata/service/gainsight/container.yml b/metadata/service/gainsight/container.yml new file mode 100644 index 0000000..d59e0ad --- /dev/null +++ b/metadata/service/gainsight/container.yml @@ -0,0 +1,8 @@ +applications: + - prometheus +parameters: + prometheus: + gainsight: + enabled: true + dir: + config: /srv/volumes/local/gainsight diff --git a/prometheus/files/gainsight.yml b/prometheus/files/gainsight.yml new file mode 100644 index 0000000..5e8330b --- /dev/null +++ b/prometheus/files/gainsight.yml @@ -0,0 +1,5 @@ +{% from "prometheus/map.jinja" import gainsight with context %} +[Queries] +{%- for query,value in gainsight.queries.iteritems() %} +{{ query }}={{ value }} +{%- endfor %} diff --git a/prometheus/gainsight.sls b/prometheus/gainsight.sls new file mode 100644 index 0000000..e5c26eb --- /dev/null +++ b/prometheus/gainsight.sls @@ -0,0 +1,18 @@ +{% from "prometheus/map.jinja" import gainsight with context %} +{%- if gainsight.enabled %} + +{%- if pillar.docker is defined and pillar.docker.host is defined %} + +{{gainsight.dir.config}}: + file.directory: + - makedirs: True + +{{gainsight.dir.config}}/config.ini: + file.managed: + - source: salt://prometheus/files/gainsight.yml + - template: jinja + - require: + - file: {{gainsight.dir.config}} + +{%- endif %} +{%- endif %} diff --git a/prometheus/map.jinja b/prometheus/map.jinja index 4df2a85..e8cc0e1 100644 --- a/prometheus/map.jinja +++ b/prometheus/map.jinja @@ -49,3 +49,10 @@ }, }, merge=salt['pillar.get']('prometheus:alerta')) %}} +{% set gainsight = salt['grains.filter_by']({ + 'default': { + 'queries': { + } + } +}, merge=salt['pillar.get']('prometheus:gainsight')) %}} +