Merge "Enable prometheus pushgateway persistent storage"

This commit is contained in:
Ildar Svetlov 2018-07-06 11:57:34 +00:00 committed by Gerrit Code Review
commit bc97b20276
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