formula-prometheus-ng/prometheus/exporter/haproxy.sls

59 lines
1.8 KiB
Text

{% from "prometheus/map.jinja" import prometheus with context %}
include:
- prometheus.user
haproxy_exporter_tarball:
archive.extracted:
- name: {{ prometheus.exporter.haproxy.install_dir }}
- source: {{ prometheus.exporter.haproxy.source }}
- source_hash: {{ prometheus.exporter.haproxy.source_hash }}
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
- archive_format: tar
- if_missing: {{ prometheus.exporter.haproxy.version_path }}
{#
haproxy_exporter_bin_link:
file.symlink:
- name: /usr/bin/haproxy_exporter
- target: {{ prometheus.exporter.haproxy.version_path }}/haproxy_exporter
- require:
- archive: haproxy_exporter_tarball
#}
haproxy_exporter_defaults:
file.managed:
- name: /etc/default/haproxy_exporter
- source: salt://prometheus-ng/files/default-haproxy_exporter.jinja
- template: jinja
- defaults:
scrape_uri: {{ prometheus.exporter.haproxy.args.scrape_uri }}
haproxy_exporter_service_unit:
file.managed:
{%- if grains.get('init') == 'systemd' %}
- name: /etc/systemd/system/haproxy_exporter.service
- source: salt://prometheus-ng/files/exporter.systemd.jinja
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/haproxy_exporter.conf
- source: salt://prometheus-ng/files/exporter.upstart.jinja
{%- endif %}
- context:
svc: node_exporter
user: {{ prometheus.user }}
group: {{ prometheus.group }}
bin_path: {{ prometheus.exporter.node.version_path }}
args: {{ prometheus.exporter.get('args', []) }}
- require_in:
- file: haproxy_exporter_service
haproxy_exporter_service:
service.running:
- name: haproxy_exporter
- enable: True
- reload: True
- watch:
- file: haproxy_exporter_service_unit
- file: haproxy_exporter_defaults
{# - file: haproxy_exporter_bin_link #}