Create data directory for am and prometheus

Change-Id: Ie89009480c06cafb15bb06ded263e49ef194dfc9
This commit is contained in:
Bartosz Kupidura 2017-05-17 16:00:52 +02:00
parent e9dc06012c
commit abec256072
8 changed files with 45 additions and 16 deletions

View file

@ -4,6 +4,9 @@ parameters:
prometheus:
alertmanager:
enabled: true
dir:
config: /srv/volumes/prometheus/alertmanager
data: /srv/volumes/local/prometheus/alertmanager
bind:
address: 0.0.0.0
port: 9093

View file

@ -6,6 +6,9 @@ parameters:
prometheus:
server:
enabled: true
dir:
config: /srv/volumes/prometheus/server
data: /srv/volumes/local/prometheus/server
bind:
port: 9090
address: 0.0.0.0

View file

@ -3,11 +3,24 @@
{%- if pillar.docker is defined and pillar.docker.host is defined %}
{{alertmanager.dir.config}}:
file.directory:
- makedirs: True
# prometheus user is available inside docker container not on docker host
# in dockerfile for alertmanager we ensure that it will have 999 uid
{{alertmanager.dir.data}}:
file.directory:
- makedirs: True
- mode: 755
- user: {{alertmanager.user}}
{{alertmanager.dir.config}}/alertmanager.yml:
file.managed:
- source: salt://prometheus/files/alertmanager.yml
- template: jinja
- makedirs: True
- require:
- file: {{alertmanager.dir.config}}
{%- endif %}
{%- endif %}

View file

@ -6,7 +6,7 @@ global:
{%- endif %}
rule_files:
- {{ server.dir.config_in_container }}/alerts.yml
- alerts.yml
{%- set static_target = {} %}
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}

View file

@ -1,16 +1,11 @@
{% set server = salt['grains.filter_by']({
'default': {
'dir': {
'config': '/srv/volumes/prometheus',
'config_in_container': '/opt/prometheus/config'
},
'user': '999',
},
}, merge=salt['pillar.get']('prometheus:server')) %}
{% set alertmanager = salt['grains.filter_by']({
'default': {
'dir': {
'config': '/srv/volumes/prometheus',
},
'user': '999',
},
}, merge=salt['pillar.get']('prometheus:alertmanager')) %}

View file

@ -3,17 +3,31 @@
{%- if pillar.docker is defined and pillar.docker.host is defined %}
{{server.dir.config}}:
file.directory:
- makedirs: True
# prometheus user is available inside docker container not on docker host
# in dockerfile for prometheus we ensure that it will have 999 uid
{{server.dir.data}}:
file.directory:
- makedirs: True
- mode: 755
- user: {{server.user}}
{{server.dir.config}}/prometheus.yml:
file.managed:
- source: salt://prometheus/files/prometheus.yml
- template: jinja
- makedirs: True
- require:
- file: {{server.dir.config}}
{{server.dir.config}}/alerts.yml:
file.managed:
- source: salt://prometheus/files/alerts.yml
- template: jinja
- makedirs: True
- require:
- file: {{server.dir.config}}
{%- endif %}
{%- endif %}

View file

@ -2,7 +2,8 @@ prometheus:
alertmanager:
enabled: true
dir:
config: /srv/volumes/prometheus
config: /srv/volumes/prometheus/alertmanager
data: /srv/volumes/local/prometheus/alertmanager
bind:
address: 0.0.0.0
port: 9093

View file

@ -2,8 +2,8 @@ prometheus:
server:
enabled: true
dir:
config: /srv/volumes/prometheus
config_in_container: /opt/prometheus/config
config: /srv/volumes/prometheus/server
data: /srv/volumes/local/prometheus/server
bind:
port: 9090
address: 0.0.0.0