diff --git a/metadata/service/gainsight/container.yml b/metadata/service/gainsight/container.yml index d59e0ad..d5a221c 100644 --- a/metadata/service/gainsight/container.yml +++ b/metadata/service/gainsight/container.yml @@ -5,4 +5,5 @@ parameters: gainsight: enabled: true dir: - config: /srv/volumes/local/gainsight + config: /srv/volumes/local/gainsight/config + crontab: /srv/volumes/local/gainsight/cron.d diff --git a/prometheus/files/gainsight.yml b/prometheus/files/gainsight/gainsight_config.yml similarity index 100% rename from prometheus/files/gainsight.yml rename to prometheus/files/gainsight/gainsight_config.yml diff --git a/prometheus/files/gainsight/gainsight_crontab.yml b/prometheus/files/gainsight/gainsight_crontab.yml new file mode 100644 index 0000000..b387053 --- /dev/null +++ b/prometheus/files/gainsight/gainsight_crontab.yml @@ -0,0 +1,2 @@ +{% from "prometheus/map.jinja" import gainsight with context %} +{{ gainsight.crontab.duration }} root /opt/gainsight/entrypoint.py >> /var/log/cron.log 2>&1 diff --git a/prometheus/gainsight.sls b/prometheus/gainsight.sls index e5c26eb..4862c3b 100644 --- a/prometheus/gainsight.sls +++ b/prometheus/gainsight.sls @@ -7,12 +7,23 @@ file.directory: - makedirs: True +{{gainsight.dir.crontab}}: + file.directory: + - makedirs: True + {{gainsight.dir.config}}/config.ini: file.managed: - - source: salt://prometheus/files/gainsight.yml + - source: salt://prometheus/files/gainsight/gainsight_config.yml - template: jinja - require: - file: {{gainsight.dir.config}} +{{gainsight.dir.crontab}}/crontab: + file.managed: + - source: salt://prometheus/files/gainsight/gainsight_crontab.yml + - template: jinja + - require: + - file: {{gainsight.dir.crontab}} + {%- endif %} {%- endif %} diff --git a/prometheus/map.jinja b/prometheus/map.jinja index e8cc0e1..a8f0378 100644 --- a/prometheus/map.jinja +++ b/prometheus/map.jinja @@ -52,7 +52,10 @@ {% set gainsight = salt['grains.filter_by']({ 'default': { 'queries': { - } + }, + 'crontab': { + 'duration': '0 0 * * *' + }, } }, merge=salt['pillar.get']('prometheus:gainsight')) %}}