Merge "Add Prometheus exporters"

This commit is contained in:
jenkins-mk jenkins-mk 2017-06-27 11:53:37 +00:00 committed by Gerrit Code Review
commit 220497bb8e
5 changed files with 48 additions and 1 deletions

View file

@ -0,0 +1,13 @@
applications:
- prometheus
parameters:
_param:
prometheus_exporter_jmx_port: 9111
prometheus:
exporters:
jmx:
enabled: true
packages:
- jmx-exporter
bind:
port: ${_param:prometheus_exporter_jmx_port}

View file

@ -0,0 +1,14 @@
applications:
- prometheus
parameters:
_param:
prometheus_exporter_libvirt_port: 9177
prometheus:
exporters:
libvirt:
enabled: true
packages:
- libvirt-exporter
bind:
address: 0.0.0.0
port: ${_param:prometheus_exporter_libvirt_port}

11
prometheus/exporters.sls Normal file
View file

@ -0,0 +1,11 @@
{% from "prometheus/map.jinja" import exporters with context %}
{%- for exporter, parameters in exporters.iteritems() %}
{%- if parameters.get('enabled', False) %}
{%- if parameters.get('packages', False) %}
{{ exporter }}_exporter_packages:
pkg.installed:
- names: {{ parameters.packages }}
{%- endif %}
{%- endif %}
{%- endfor %}

View file

@ -1,5 +1,6 @@
{%- if pillar.prometheus.server is defined or
pillar.prometheus.alertmanager is defined %}
pillar.prometheus.alertmanager is defined or
pillar.prometheus.exporters is defined %}
include:
{%- if pillar.prometheus.server is defined %}
- prometheus.server
@ -7,4 +8,7 @@ include:
{%- if pillar.prometheus.alertmanager is defined %}
- prometheus.alertmanager
{%- endif %}
{%- if pillar.prometheus.exporters is defined %}
- prometheus.exporters
{%- endif %}
{%- endif %}

View file

@ -7,3 +7,8 @@
'default': {
},
}, merge=salt['pillar.get']('prometheus:alertmanager')) %}
{% set exporters = salt['grains.filter_by']({
'default': {
},
}, merge=salt['pillar.get']('prometheus:exporters')) %}