Enable prometheus pushgateway persistent storage

Change-Id: If539f26909bd56b168a806773bb9c6574c86bf40
Closes-bug: PROD-21073
This commit is contained in:
Michal Kobus 2018-06-29 18:08:49 +02:00
parent 6affd12cc0
commit 2b64974054
5 changed files with 29 additions and 0 deletions

View file

@ -7,3 +7,5 @@ parameters:
bind:
address: 0.0.0.0
port: 9091
dir:
data: /srv/volumes/local/pushgateway

View file

@ -1,6 +1,7 @@
{%- if pillar.prometheus.get('server', {}).get('enabled', False) or
pillar.prometheus.get('relay', {}).get('enabled', False) or
pillar.prometheus.get('alerta', {}).get('enabled', False) or
pillar.prometheus.get('pushgateway', {}).get('enabled', False) or
pillar.prometheus.alertmanager is defined or
pillar.prometheus.exporters is defined %}
include:
@ -13,6 +14,9 @@ include:
{%- if pillar.prometheus.get('alerta', {}).get('enabled', False) %}
- prometheus.alerta
{%- endif %}
{%- if pillar.prometheus.get('pushgateway', {}).get('enabled', False) %}
- prometheus.pushgateway
{%- endif %}
{%- if pillar.prometheus.alertmanager is defined %}
- prometheus.alertmanager
{%- endif %}

View file

@ -26,6 +26,15 @@
}, merge=salt['pillar.get']('prometheus:exporters')) %}
{%- do salt['defaults.merge'](exporters, grains.get('prometheus', {}).get('exporters', {})) %}
{% set pushgateway = salt['grains.filter_by']({
'default': {
'enabled': True,
'dir': {
'data': '/srv/volumes/local/pushgateway',
}
},
}, merge=salt['pillar.get']('prometheus:pushgateway')) %}
{%- set monitoring = salt['grains.filter_by']({
'default': {
'remote_storage_adapter': {

View file

@ -0,0 +1,12 @@
{% from "prometheus/map.jinja" import pushgateway with context %}
{%- if pushgateway.enabled %}
{%- if pillar.docker is defined and pillar.docker.host is defined %}
{{pushgateway.dir.data}}:
file.directory:
- makedirs: True
- mode: 755
{%- endif %}
{%- endif %}

View file

@ -5,3 +5,5 @@ prometheus:
address: 0.0.0.0
port: 9091
external_port: 15012
dir:
data: /opt/pushgateway/data