Add rabbitmq exporter support

pull/1/head
Steven Joseph 5 years ago
parent 2d80ee6c8b
commit 1666766223
  1. 49
      prometheus/exporter/rabbitmq.sls
  2. 20
      prometheus/files/default-rabbitmq.jinja
  3. 18
      prometheus/files/rabbitmq_exporter.systemd.jinja

@ -0,0 +1,49 @@
{% 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/files/default-rabbitmq_exporter.jinja
- template: jinja
rabbitmq_exporter_service_unit:
file.managed:
{%- if grains.get('init') == 'systemd' %}
- name: /etc/systemd/system/rabbitmq_exporter.service
- source: salt://prometheus/files/rabbitmq_exporter.systemd.jinja
{%- elif grains.get('init') == 'upstart' %}
- name: /etc/init/rabbitmq_exporter.conf
- source: salt://prometheus/files/rabbitmq_exporter.upstart.jinja
{%- endif %}
- 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

@ -0,0 +1,20 @@
#https://github.com/kbudde/rabbitmq_exporter
RABBIT_CAPABILITIES=no_sort,bert
#Environment variable|default|description
#--------------------|-------|------------
#RABBIT_URL | <http://localhost:15672>| url to rabbitMQ management plugin
#RABBIT_USER | guest | username for rabbitMQ management plugin
#RABBIT_PASSWORD | guest | password for rabbitMQ management plugin
#RABBIT_USER_FILE| | location of file with username (useful for docker secrets)
#RABBIT_PASSWORD_FILE | | location of file with password (useful for docker secrets)
#PUBLISH_PORT | 9090 | Listening port for the exporter
#OUTPUT_FORMAT | TTY | Log ouput format. TTY and JSON are suported
#LOG_LEVEL | info | log level. possible values: "debug", "info", "warning", "error", "fatal", or "panic"
#CAFILE | ca.pem | path to root certificate for access management plugin. Just needed if self signed certificate is used. Will be ignored if the file does not exist
#SKIPVERIFY | false | true/0 will ignore certificate errors of the management plugin
#INCLUDE_QUEUES | .* | reqgex queue filter. just matching names are exported
#SKIP_QUEUES | ^$ |regex, matching queue names are not exported (useful for short-lived rpc queues). First performed INCLUDE, after SKIP
#RABBIT_CAPABILITIES | | comma-separated list of extended scraping capabilities supported by the target RabbitMQ server
#RABBIT_EXPORTERS | exchange,node,overview,queue | List of enabled modules. Just "connections" is not enabled by default

@ -0,0 +1,18 @@
[Unit]
Description=Prometheus rabbitmq exporter
Documentation=https://github.com/kbudde/rabbitmq_exporter
Wants=basic.target
After=basic.target network.target
[Service]
User=prometheus
Group=prometheus
EnvironmentFile=/etc/default/rabbitmq_exporter
ExecStart=/usr/bin/rabbitmq_exporter
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
RestartSec=42s
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save