Flower monitoring setup and configuration for Celery including real-time monitoring, authentication, custom dashboards, and Prometheus metrics integration. Use when setting up Celery monitoring, configuring Flower web UI, implementing authentication, creating custom dashboards, integrating with Prometheus, or when user mentions Flower, Celery monitoring, task monitoring, worker monitoring, or real-time metrics.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
examples/custom-dashboards.mdexamples/flower-setup.mdexamples/prometheus-integration.mdscripts/flower-systemd.servicescripts/start-flower.shscripts/test-flower.shtemplates/custom-dashboard.pytemplates/flower-auth.pytemplates/flower-config.pytemplates/prometheus-metrics.pyThis skill provides comprehensive templates and configurations for setting up Flower, the real-time monitoring tool for Celery. Includes authentication, custom dashboards, Prometheus metrics integration, and production deployment patterns.
Flower is a web-based monitoring and administration tool for Celery that provides:
This skill covers production-ready Flower deployments with security and scalability.
Script: scripts/start-flower.sh <broker-url> <port>
Purpose: Starts Flower monitoring server with proper configuration
Parameters:
broker-url - Redis/RabbitMQ broker URL (default: redis://localhost:6379/0)port - Port to run Flower on (default: 5555)Usage:
# Start with default settings
./scripts/start-flower.sh
# Start with custom Redis broker
./scripts/start-flower.sh redis://redis:6379/0 5555
# Start with RabbitMQ
./scripts/start-flower.sh amqp://guest:guest@localhost:5672// 5555
# Start with authentication
FLOWER_BASIC_AUTH="user:password" ./scripts/start-flower.sh
Environment Variables:
FLOWER_BASIC_AUTH - Basic auth credentials (user:password)FLOWER_OAUTH2_REDIRECT_URI - OAuth2 redirect URIFLOWER_MAX_TASKS - Maximum tasks to keep in memory (default: 10000)Output: Flower web UI available at http://localhost:5555
Script: scripts/flower-systemd.service
Purpose: Systemd service file for production Flower deployment
Usage:
# Copy service file
sudo cp scripts/flower-systemd.service /etc/systemd/system/flower.service
# Edit service file with your paths
sudo nano /etc/systemd/system/flower.service
# Reload systemd
sudo systemctl daemon-reload
# Enable and start service
sudo systemctl enable flower
sudo systemctl start flower
# Check status
sudo systemctl status flower
Configuration Points:
WorkingDirectory - Your project directoryUser - User to run service asEnvironment - Broker URL and authenticationExecStart - Flower command with optionsScript: scripts/test-flower.sh <flower-url>
Purpose: Validates Flower setup and connectivity
Checks:
Usage:
# Test local Flower instance
./scripts/test-flower.sh http://localhost:5555
# Test with authentication
./scripts/test-flower.sh http://user:password@localhost:5555
# Test production instance
./scripts/test-flower.sh https://flower.example.com
Exit Codes:
0 - All checks passed1 - Flower not accessible2 - No workers detected3 - Authentication issuesTemplate: templates/flower-config.py
Purpose: Complete Flower configuration file with all options
Features:
Usage:
# Save as flowerconfig.py in your project
# Flower will auto-detect this file
# Or specify explicitly:
celery -A myapp flower --conf=flowerconfig.py
Key Configuration Options:
broker_api - Broker management API URLpersistent - Enable database persistencedb - SQLite database pathmax_tasks - Task history limiturl_prefix - Prefix for reverse proxyTemplate: templates/flower-auth.py
Purpose: Authentication configurations including basic auth and OAuth
Authentication Methods:
Basic Authentication:
# Username/password protection
flower --basic_auth=user1:password1,user2:password2
OAuth2 (Google):
# Google OAuth integration
flower \
--auth=".*@example\.com" \
--oauth2_key=your_google_client_id_here \
--oauth2_secret=your_google_client_secret_here \
--oauth2_redirect_uri=http://localhost:5555/login
Custom Authentication:
# Implement custom auth provider
from flower.views.auth import Auth
class CustomAuth(Auth):
def authenticate(self, username, password):
# Your authentication logic
return username in allowed_users
Security Notes:
Template: templates/prometheus-metrics.py
Purpose: Export Celery metrics to Prometheus
Metrics Exposed:
celery_tasks_total - Total tasks by statecelery_workers_online - Active worker countcelery_task_runtime_seconds - Task execution timecelery_queue_length - Queue depth by queue nameUsage:
# Run metrics exporter alongside Flower
python templates/prometheus-metrics.py
# Metrics available at http://localhost:8000/metrics
Prometheus Scrape Config:
scrape_configs:
- job_name: 'celery'
static_configs:
- targets: ['localhost:8000']
Grafana Integration:
Template: templates/custom-dashboard.py
Purpose: Create custom Flower views for specific workflows
Custom Views:
Implementation:
from flower.views import BaseHandler
class CustomDashboard(BaseHandler):
def get(self):
# Your custom dashboard logic
self.render("custom_dashboard.html", data=data)
Template Variables:
workers - Active worker listtasks - Recent task historyqueues - Queue statisticscustom_metrics - Your computed metricsExample: examples/flower-setup.md
Covers:
Step-by-Step Guide:
pip install flowerProduction Checklist:
Example: examples/prometheus-integration.md
Covers:
Metrics Collection:
# Key metrics to monitor
- Task success/failure rates
- Average task duration
- Queue depths
- Worker availability
- Task retries
- Error rates by task type
Alert Examples:
Example: examples/custom-dashboards.md
Covers:
Use Cases:
Custom View Features:
CRITICAL: This skill follows strict security rules:
❌ NEVER hardcode:
✅ ALWAYS:
.env.example with placeholders.env* to .gitignorePlaceholder format:
# .env.example
FLOWER_BASIC_AUTH=username_your_password_here
FLOWER_OAUTH2_KEY=your_google_client_id_here
FLOWER_OAUTH2_SECRET=your_google_client_secret_here
CELERY_BROKER_URL=redis_your_password_here@localhost:6379/0
This skill provides immediate setup guidance with references to detailed documentation:
start-flower.sh for immediate local setupflower-setup.md for complete deployment guideprometheus-metrics.py for monitoring integrationcustom-dashboards.md for advanced customizationLoad additional files only when specific customization is needed.
# Install Flower
pip install flower
# Start with basic auth
FLOWER_BASIC_AUTH="dev:dev_password_here" \
./scripts/start-flower.sh redis://localhost:6379/0 5555
# Access at http://localhost:5555
# 1. Configure authentication
cp templates/flower-auth.py flowerconfig.py
# Edit with environment-specific settings
# 2. Install systemd service
sudo cp scripts/flower-systemd.service /etc/systemd/system/flower.service
sudo systemctl enable flower
sudo systemctl start flower
# 3. Configure Nginx reverse proxy
# 4. Enable SSL with Let's Encrypt
# 5. Test connectivity
./scripts/test-flower.sh https://flower.example.com
# 1. Start Prometheus metrics exporter
python templates/prometheus-metrics.py &
# 2. Configure Prometheus scraping
# 3. Import Grafana dashboard
# 4. Set up alerting rules
Check:
Debug:
# Test broker connectivity
celery -A myapp inspect ping
# Check port availability
lsof -i :5555
# Run with verbose logging
celery -A myapp flower --logging=debug
Check:
Fix:
# Enable events on workers
celery -A myapp control enable_events
# Verify broker URL matches
echo $CELERY_BROKER_URL
Check:
Debug:
# Test basic auth
curl -u username:password http://localhost:5555
# Check OAuth configuration
curl http://localhost:5555/login
Required:
flower>=2.0.0 - Flower monitoring toolcelery>=5.3.0 - Celery task queueredis>=4.5.0 or kombu>=5.3.0 - Broker clientOptional:
prometheus-client>=0.16.0 - For Prometheus metricstornado>=6.0 - For async supportSQLAlchemy>=2.0.0 - For persistent storageInstallation:
# Basic installation
pip install flower
# With Prometheus metrics
pip install flower prometheus-client
# With persistent storage
pip install flower sqlalchemy
max_tasks to prevent memory issuesexamples/flower-setup.md