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

56 lines
1.8 KiB
Text
Raw Normal View History

2017-11-21 05:59:09 -05:00
{% from "prometheus/map.jinja" import prometheus with context %}
include:
- prometheus.user
rabbitmq_exporter_tarball:
archive.extracted:
- name: {{ prometheus.exporter.rabbitmq.install_dir }}
- source: {{ prometheus.exporter.rabbitmq.source }}
- source_hash: {{ prometheus.exporter.rabbitmq.source_hash }}
- user: {{ prometheus.user }}
- group: {{ prometheus.group }}
- archive_format: tar
- if_missing: {{ prometheus.exporter.rabbitmq.version_path }}
rabbitmq_exporter_bin_link:
file.symlink:
- name: /usr/bin/rabbitmq_exporter
- target: {{ prometheus.exporter.rabbitmq.version_path }}/rabbitmq_exporter
- require:
- archive: rabbitmq_exporter_tarball
rabbitmq_exporter_defaults:
file.managed:
- name: /etc/default/rabbitmq_exporter
- source: salt://prometheus-ng/files/default-rabbitmq_exporter.jinja
2017-11-21 05:59:09 -05:00
- template: jinja
rabbitmq_exporter_service_unit:
file.managed:
{%- if grains.get('init') == 'systemd' %}
- name: /etc/systemd/system/rabbitmq_exporter.service
- source: salt://prometheus-ng/files/exporter.systemd.jinja
2017-11-21 05:59:09 -05:00
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/rabbitmq_exporter.conf
- source: salt://prometheus-ng/files/exporter.upstart.jinja
2017-11-21 05:59:09 -05:00
{%- endif %}
- context:
svc: node_exporter
user: {{ prometheus.user }}
group: {{ prometheus.group }}
bin_path: {{ prometheus.exporter.node.version_path }}
args: {{ prometheus.exporter.get('args', []) }}
2017-11-21 05:59:09 -05:00
- require_in:
- file: rabbitmq_exporter_service
rabbitmq_exporter_service:
service.running:
- name: rabbitmq_exporter
- enable: True
- reload: True
- watch:
- file: rabbitmq_exporter_service_unit
- file: rabbitmq_exporter_defaults
- file: rabbitmq_exporter_bin_link