docker.recipes

RabbitMQ + Management + Prometheus

intermediate

Message broker with management UI and monitoring.

Overview

RabbitMQ is a robust, enterprise-grade message broker that implements the Advanced Message Queuing Protocol (AMQP) and serves as the backbone for distributed system communication. Originally developed by Rabbit Technologies in 2007 and later acquired by VMware, RabbitMQ has become the most widely deployed open-source message broker, handling millions of messages per second in production environments worldwide. Its strength lies in reliable message delivery, flexible routing capabilities, and support for multiple messaging protocols including AMQP, MQTT, and STOMP. This monitoring stack combines RabbitMQ's management interface with Prometheus metrics collection and Grafana visualization to create a comprehensive observability solution. Prometheus scrapes metrics from RabbitMQ's built-in prometheus plugin (exposed on port 15692), while Grafana transforms this time-series data into actionable dashboards. The management UI provides real-time queue inspection and administrative controls, while Prometheus captures historical performance data for trend analysis and alerting. Development teams building microservices architectures, platform engineers managing message-driven systems, and operations teams requiring deep visibility into message broker performance will find this stack invaluable. The combination provides both immediate troubleshooting capabilities through the management UI and long-term capacity planning insights through Grafana dashboards, making it essential for production RabbitMQ deployments.

Key Features

  • AMQP 0-9-1 protocol implementation with message acknowledgments and persistent queues
  • Built-in Prometheus metrics exporter providing queue depth, message rates, and connection statistics
  • Web-based management interface for queue inspection, exchange configuration, and user management
  • PromQL query language support for complex metric aggregation and alerting rules
  • Multi-protocol support including MQTT for IoT devices and STOMP for web applications
  • Grafana dashboard templating for monitoring multiple RabbitMQ clusters from single interface
  • Dead letter exchange handling for failed message processing and debugging
  • Time-series metric storage with configurable retention policies in Prometheus

Common Use Cases

  • 1Microservices event-driven architectures requiring reliable inter-service communication monitoring
  • 2IoT platforms processing MQTT messages with need for throughput and latency visibility
  • 3E-commerce order processing systems monitoring queue backlogs and processing rates
  • 4Task queue systems like Celery requiring worker performance and job completion tracking
  • 5Financial services message processing with strict delivery guarantees and audit trails
  • 6DevOps teams implementing infrastructure monitoring for message broker capacity planning
  • 7Development environments requiring message flow debugging and performance optimization

Prerequisites

  • Docker Engine 20.10+ and Docker Compose 2.0+ with at least 2GB available RAM
  • Basic understanding of message queuing concepts and AMQP protocol fundamentals
  • Familiarity with PromQL query language for creating custom Grafana dashboard panels
  • Network ports 3000, 5672, 9090, 15672, and 15692 available on the host system
  • Knowledge of RabbitMQ exchange types (direct, topic, fanout) for effective monitoring setup

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 rabbitmq:
3 image: rabbitmq:3-management
4 environment:
5 - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
6 - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
7 volumes:
8 - rabbitmq-data:/var/lib/rabbitmq
9 - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
10 ports:
11 - "5672:5672"
12 - "15672:15672"
13 - "15692:15692"
14 networks:
15 - rabbitmq-network
16 restart: unless-stopped
17
18 prometheus:
19 image: prom/prometheus:latest
20 command:
21 - --config.file=/etc/prometheus/prometheus.yml
22 - --storage.tsdb.path=/prometheus
23 volumes:
24 - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
25 - prometheus-data:/prometheus
26 ports:
27 - "9090:9090"
28 networks:
29 - rabbitmq-network
30 restart: unless-stopped
31
32 grafana:
33 image: grafana/grafana:latest
34 environment:
35 - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
36 volumes:
37 - grafana-data:/var/lib/grafana
38 ports:
39 - "3000:3000"
40 depends_on:
41 - prometheus
42 networks:
43 - rabbitmq-network
44 restart: unless-stopped
45
46volumes:
47 rabbitmq-data:
48 prometheus-data:
49 grafana-data:
50
51networks:
52 rabbitmq-network:
53 driver: bridge

.env Template

.env
1# RabbitMQ
2RABBITMQ_USER=admin
3RABBITMQ_PASSWORD=secure_rabbitmq_password
4GRAFANA_PASSWORD=secure_grafana_password
5
6# Enable prometheus plugin in rabbitmq.conf

Usage Notes

  1. 1AMQP at port 5672
  2. 2Management at http://localhost:15672
  3. 3Prometheus metrics at port 15692
  4. 4Grafana at http://localhost:3000
  5. 5Enable plugins: rabbitmq-plugins enable rabbitmq_prometheus

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

rabbitmq
rabbitmq:
  image: rabbitmq:3-management
  environment:
    - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
    - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
  volumes:
    - rabbitmq-data:/var/lib/rabbitmq
    - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
  ports:
    - "5672:5672"
    - "15672:15672"
    - "15692:15692"
  networks:
    - rabbitmq-network
  restart: unless-stopped
prometheus
prometheus:
  image: prom/prometheus:latest
  command:
    - "--config.file=/etc/prometheus/prometheus.yml"
    - "--storage.tsdb.path=/prometheus"
  volumes:
    - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
    - prometheus-data:/prometheus
  ports:
    - "9090:9090"
  networks:
    - rabbitmq-network
  restart: unless-stopped
grafana
grafana:
  image: grafana/grafana:latest
  environment:
    - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
  volumes:
    - grafana-data:/var/lib/grafana
  ports:
    - "3000:3000"
  depends_on:
    - prometheus
  networks:
    - rabbitmq-network
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 rabbitmq:
5 image: rabbitmq:3-management
6 environment:
7 - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
8 - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
9 volumes:
10 - rabbitmq-data:/var/lib/rabbitmq
11 - ./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
12 ports:
13 - "5672:5672"
14 - "15672:15672"
15 - "15692:15692"
16 networks:
17 - rabbitmq-network
18 restart: unless-stopped
19
20 prometheus:
21 image: prom/prometheus:latest
22 command:
23 - --config.file=/etc/prometheus/prometheus.yml
24 - --storage.tsdb.path=/prometheus
25 volumes:
26 - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
27 - prometheus-data:/prometheus
28 ports:
29 - "9090:9090"
30 networks:
31 - rabbitmq-network
32 restart: unless-stopped
33
34 grafana:
35 image: grafana/grafana:latest
36 environment:
37 - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
38 volumes:
39 - grafana-data:/var/lib/grafana
40 ports:
41 - "3000:3000"
42 depends_on:
43 - prometheus
44 networks:
45 - rabbitmq-network
46 restart: unless-stopped
47
48volumes:
49 rabbitmq-data:
50 prometheus-data:
51 grafana-data:
52
53networks:
54 rabbitmq-network:
55 driver: bridge
56EOF
57
58# 2. Create the .env file
59cat > .env << 'EOF'
60# RabbitMQ
61RABBITMQ_USER=admin
62RABBITMQ_PASSWORD=secure_rabbitmq_password
63GRAFANA_PASSWORD=secure_grafana_password
64
65# Enable prometheus plugin in rabbitmq.conf
66EOF
67
68# 3. Start the services
69docker compose up -d
70
71# 4. View logs
72docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/rabbitmq-complete/run | bash

Troubleshooting

  • Connection refused on port 15692: Enable Prometheus plugin with 'rabbitmq-plugins enable rabbitmq_prometheus' command in container
  • Grafana shows no data from Prometheus: Verify prometheus.yml contains correct RabbitMQ scrape target 'rabbitmq:15692'
  • RabbitMQ management UI login fails: Check RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS environment variables are set
  • High memory usage in RabbitMQ container: Configure message TTL and queue length limits in rabbitmq.conf file
  • Prometheus target shows as down: Ensure rabbitmq_prometheus plugin is enabled and port 15692 is accessible between containers
  • Missing metrics in Grafana dashboards: Import official RabbitMQ dashboard ID 10991 from Grafana dashboard library

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space