Added postgres_exporter

master
Eric Renfro 4 years ago
parent b6476b8877
commit ae8faab1e3
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
  1. 9
      prometheus/defaults.yaml
  2. 59
      prometheus/exporter/postgres.sls
  3. 1
      prometheus/map.jinja

@ -56,3 +56,12 @@ prometheus:
args:
url: https://github.com/kbudde/rabbitmq_exporter
service_args: []
postres:
version: 0.4.7_linux-amd64
install_dir: /opt
source: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.4.7/postgres_exporter_v0.4.7_linux-amd64.tar.gz
source_hash: sha256=c34d61bb4deba8efae06fd3c9979b96dae3f3c757698ce3384c80fff586c667b
args:
url: https://github.com/wrouesnel/postgres_exporter
service_args: []

@ -0,0 +1,59 @@
{% from "prometheus/map.jinja" import prometheus with context %}
include:
- prometheus.user
postgres_exporter_tarball:
archive.extracted:
- name: {{ prometheus.exporter.postgres.install_dir }}
- source: {{ prometheus.exporter.postgres.source }}
- source_hash: {{ prometheus.exporter.postgres.source_hash }}
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
- archive_format: tar
- if_missing: {{ prometheus.exporter.postgres.version_path }}
{#
postgres_exporter_bin_link:
file.symlink:
- name: /usr/bin/postgres_exporter
- target: {{ prometheus.exporter.postgres.version_path }}/postgres_exporter
- require:
- archive: postgres_exporter_tarball
#}
postgres_exporter_defaults:
file.managed:
- name: /etc/default/postgres_exporter
- source: salt://prometheus/files/default-postgres_exporter.jinja
- template: jinja
postgres_exporter_service_unit:
file.managed:
{%- if grains.get('init') == 'systemd' %}
- name: /etc/systemd/system/postgres_exporter.service
- source: salt://prometheus/files/exporter.systemd.jinja
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/postgres_exporter.conf
- source: salt://prometheus/files/exporter.upstart.jinja
{%- endif %}
- template: jinja
- defaults:
svc: postgres_exporter
user: {{ prometheus.user }}
group: {{ prometheus.group }}
bin_path: {{ prometheus.exporter.postgres.version_path }}
args: {{ prometheus.exporter.postgres.args.service_args }}
url: {{ prometheus.exporter.postgres.args.url }}
- require_in:
- file: postgres_exporter_service
postgres_exporter_service:
service.running:
- name: postgres_exporter
- enable: True
- reload: False
- watch:
- file: postgres_exporter_service_unit
- file: postgres_exporter_defaults
{# - file: postgres_exporter_bin_link #}

@ -9,4 +9,5 @@
{% do prometheus.exporter.blackbox.update({'version_path': prometheus.exporter.blackbox.install_dir ~ "/blackbox_exporter-" ~ prometheus.exporter.blackbox.version}) %}
{% do prometheus.exporter.haproxy.update({'version_path': prometheus.exporter.haproxy.install_dir ~ "/haproxy_exporter-" ~ prometheus.exporter.haproxy.version}) %}
{% do prometheus.exporter.rabbitmq.update({'version_path': prometheus.exporter.rabbitmq.install_dir ~ "/rabbitmq_exporter-" ~ prometheus.exporter.rabbitmq.version}) %}
{% do prometheus.exporter.postgres.update({'version_path': prometheus.exporter.postgres.install_dir ~ "/postgres_exporter-" ~ prometheus.exporter.postgres.version}) %}

Loading…
Cancel
Save