deadtrickster / prometheus_rabbitmq_exporter

Prometheus.io exporter as a RabbitMQ Managment Plugin plugin
MIT License
291 stars 72 forks source link
instrumentation metrics monitoring prometheus rabbitmq

RabbitMQ Prometheus.io exporter Build Status Docker Pulls

STOP! This is abandonware!

Modern RabbitMQ release series ship with a built-in Prometheus plugin and a set of Grafana dashboards.

This plugin is obsolete and really should not be used. It will not be compatible with the latest versions of RabbitMQ, you will not get any support for the RabbitMQ Core team, and there are no reasons to choose this plugin over the built-in one.

What does this plugin do?

Implemented as RabbitMQ Management Plugin plugin. Also exports Erlang VM and process metrics (~ 100 metrics in total).

Implemented using Erlang Prometheus.io client

rabbitmq prometheus exporter grafana dashboard

TOC

Versioning

While RabbitMQ transitions from webmachine to cowboy we maintain two branches one for 3.6.x and one for 3.7.x. Plugin version should be read as follows: 3.7.1.x - where 3.7.1 is required RabbitMQ version and x is just incremental version of the plugin.

Installation

Download suitable version and follow regular RabbitMQ plugin installation instructions.

 rabbitmq-plugins enable prometheus_rabbitmq_exporter

If you are running on Linux/FreeBSD/Mac, you may find prometheus_process_exporter useful:

rabbitmq-plugins enable prometheus_process_collector

Prometheus process collector.

Troubleshooting

undef error

If you see something like this:

{could_not_start,rabbitmq_management,
       {undef,
           [{prometheus_http,setup,[],[]}

I.e. undef error mentioning a module starting with prometheus_, chances you forgot to enable a plugin (see https://github.com/deadtrickster/prometheus_rabbitmq_exporter/issues/27 for example).

Module prometheus_process_collector is unloadable

{plugin_module_unloadable,"prometheus_process_collector",
                             {error,on_load_failure}}

or

{error,{load_failed,"Failed to load NIF library:
 '/<...>/plugins/prometheus_process_collector-1.1.0/priv/prometheus_process_collector.so:
 failed to map segment from shared object'"}}

Prometheus process collector uses NIFs underneath and failed to load shared object in module on_load callback. Please check that RABBITMQ_PLUGINS_EXPAND_DIR doesn't have noexec flag set (see https://github.com/deadtrickster/prometheus_rabbitmq_exporter/issues/26).

Crashes with something like {error,{bad_lib,"Library version (2.11) not compatible (with 2.10)."}}

This means erl_nif version prometheus_process_collector built with differs from yours (see Version Management section). You can rebuild the plugin yourself very easily - clone https://github.com/deadtrickster/prometheus_process_collector.git and run rebar3 archive

Glibc-related errors when prometheus_process_collector enabled

prometheus_process_collector plugin comes with prebuilt shared object. And it looks like my Glibc version differs from yours. You can rebuild the plugin yourself very easily - clone https://github.com/deadtrickster/prometheus_process_collector.git and run rebar3 archive

Latest Docker:

docker run -p 8080:15672 deadtrickster/rabbitmq_prometheus

Alpine-based image is also available: docker run -p 8080:15672 deadtrickster/rabbitmq_prometheus:latest-alpine

Configuration

This exporter supports the following options via rabbitmq_exporter entry of prometheus app env:

Sample /etc/rabbitmq/rabbitmq.config showing how to customize the scrape path, and connections_total_enabled:

[
 {rabbit, [
   {loopback_users, []},
   {tcp_listeners, [5672]},
   {ssl_listeners, []}
 ]},
 {prometheus, [
   {rabbitmq_exporter, [
     {path, "/mymetrics"},
     {connections_total_enabled, true}
   ]}
 ]},
 {rabbitmq_management, [
   {listener, [
     {port, 15672},
     {ssl, false}
   ]}
 ]}
].

For the latest list of supported options look here.

Metrics

RabbitMQ Specific Metrics

Overview

Queues

Labels: vhost, queue.

Exchanges

Labels: vhost, exchange.

Mnesia Tables

Various metrics for RabbitMQ-specific Mnesia tables.

Labels: table.

Nodes

Cluster/nodes metrics.

Erlang VM & OTP Metrics

System Info

Statistics

Memory

Mnesia

Process Metrics

(Process info collector must be enabled)

Exporter Metrics

Labels: registry, content_type.

License

MIT