Add Prometheus exporters

Change-Id: I71538bc6b39edaa6a0856c8bba9de11b88cec67a
This commit is contained in:
Olivier Bourdon 2017-06-23 12:28:48 +02:00
parent ba40adbc35
commit e8c7be754f
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')) %}