This guide covers the manual setup and configuration of Grafana for monitoring your Torrust Tracker deployment. Grafana provides powerful dashboards and visualization capabilities for tracker metrics and system monitoring.
After deploying the Torrust Tracker with the included Docker Compose configuration, Grafana is available but requires manual setup to:
- Secure the default admin account
- Configure Prometheus as a data source
- Import pre-built dashboards (optional)
- Create custom dashboards (optional)
This process is intentionally manual to allow users flexibility in customizing their monitoring setup according to their specific needs.
- Torrust Tracker deployed with Docker Compose (local or cloud)
- Grafana service running (included in the Docker Compose stack)
- Prometheus service running (included in the Docker Compose stack)
- Access to the Grafana web interface
-
For local deployment:
# Access via browser open http://localhost:3100/ -
For remote deployment:
# Replace <server-ip> with your actual server IP open http://<server-ip>:3100/
- Username:
admin - Password:
admin
Important: You will be prompted to change the password immediately after first login.
- After logging in with
admin/admin, Grafana will prompt you to change the password - Choose a strong password and confirm the change
- Record this password securely - you'll need it for future access
If you're in a development environment, you can skip the password change, but this is not recommended for any deployment that might be accessible from outside your local machine.
-
Navigate to Data Sources:
- Click the gear icon (⚙️) in the left sidebar
- Select "Data sources"
- Click "Add data source"
-
Select Prometheus:
- Click on "Prometheus" from the list of available data sources
-
Configure Connection:
- Name:
Prometheus(or any name you prefer) - URL:
- For local deployment:
http://prometheus:9090 - For remote deployment:
http://prometheus:9090
- For local deployment:
Note: Use the Docker container name
prometheussince Grafana runs in the same Docker network as Prometheus. - Name:
-
Test Connection:
- Scroll down and click "Save & Test"
- You should see a green "Data source is working" message
-
Navigate to Explore:
- Click the compass icon (🧭) in the left sidebar
- Select your Prometheus data source
-
Test a Query:
- In the query box, type:
torrust_tracker_announces_total - Click "Run Query" or press Shift+Enter
- You should see metrics data if the tracker is running and processing requests
- In the query box, type:
The repository includes pre-built Grafana dashboards that provide comprehensive monitoring for the Torrust Tracker.
The dashboard backups are located in:
application/share/grafana/dashboards/-
Navigate to Dashboard Import:
- Click the "+" icon in the left sidebar
- Select "Import"
-
Import JSON:
- Click "Upload JSON file"
- Navigate to
application/share/grafana/dashboards/ - Select a dashboard file (
stats.jsonormetrics.json) - Click "Load"
-
Configure Import:
- Review the dashboard name and UID
- Select your Prometheus data source from the dropdown
- Click "Import"
-
Open Dashboard File:
# View dashboard JSON content (example with stats dashboard) cat application/share/grafana/dashboards/stats.json -
Copy JSON Content:
- Copy the entire JSON content from the file
-
Import in Grafana:
- In Grafana, go to "+" → "Import"
- Paste the JSON content in the text area
- Click "Load" and configure as above
The repository includes pre-built dashboard configurations:
stats.json: Dashboard using metrics from the tracker's/api/v1/statsendpointmetrics.json: Dashboard using metrics from the tracker's/api/v1/metricsendpoint
These dashboards provide:
- Tracker Overview: General tracker metrics and performance
- API Monitoring: Tracker API endpoint statistics and response times
- System Analytics: Connection counts, bandwidth, and operational metrics
Note: Check the application/share/grafana/dashboards/README.md for the latest
information about available dashboard configurations.
-
Open Imported Dashboard:
- Navigate to "Dashboards" (four squares icon) in the left sidebar
- Click on your imported dashboard
-
Verify Metrics:
- Panels should display data if the tracker is active
- If panels show "No data", verify:
- Prometheus data source is configured correctly
- Tracker is running and processing requests
- Time range is appropriate (try "Last 1 hour" or "Last 6 hours")
If dashboards appear empty:
-
Check Time Range:
- Use the time picker in the top-right corner
- Try "Last 1 hour" or "Last 24 hours"
-
Verify Data Source:
- Go to dashboard settings (gear icon)
- Ensure the correct Prometheus data source is selected
-
Test Queries Manually:
- Go to "Explore" and test individual metrics
- Common tracker metrics to test:
torrust_tracker_announces_totaltorrust_tracker_scrapes_totaltorrust_tracker_connections_total
-
Start New Dashboard:
- Click "+" → "Dashboard"
- Click "Add visualization"
-
Select Data Source:
- Choose your Prometheus data source
-
Configure Panel:
- Query: Enter a Prometheus query (e.g.,
rate(torrust_tracker_announces_total[5m])) - Visualization: Choose chart type (Time series, Stat, Gauge, etc.)
- Panel title: Give your panel a descriptive name
- Query: Enter a Prometheus query (e.g.,
-
Save Dashboard:
- Click "Save" (disk icon)
- Provide a name and optional description
- Choose a folder or leave in "General"
Here are some useful metrics to monitor:
# Announce rate (requests per second)
rate(torrust_tracker_announces_total[5m])
# Active torrents count
torrust_tracker_torrents
# Active peers (seeders + leechers)
torrust_tracker_seeders + torrust_tracker_leechers
# Error rate
rate(torrust_tracker_errors_total[5m])
# Response time percentiles
histogram_quantile(0.95, rate(torrust_tracker_response_time_seconds_bucket[5m]))
If you need to verify your Prometheus configuration, it should include:
# prometheus.yml (for reference)
global:
scrape_interval: 15s
scrape_configs:
- job_name: "torrust-tracker"
static_configs:
- targets: ["tracker:1212"] # Tracker metrics endpoint
metrics_path: "/metrics"
scrape_interval: 10sFor a panel showing announce rate:
{
"expr": "rate(torrust_tracker_announces_total[5m])",
"legendFormat": "Announces per second",
"refId": "A"
}-
Monitor Disk Usage:
- Prometheus data grows over time
- Configure retention policies if needed
-
Dashboard Updates:
- Check repository for updated dashboard files
- Import new versions when available
-
Security:
- Regularly update Grafana admin password
- Consider setting up additional user accounts
To backup your custom dashboards:
-
Export Dashboard:
- Open dashboard settings (gear icon)
- Click "JSON Model"
- Copy the JSON content
-
Save to File:
# Save your custom dashboard echo '{"dashboard": {...}}' > my-custom-dashboard.json
# Check if Grafana container is running
docker compose ps grafana
# Check Grafana logs
docker compose logs grafana
# Restart Grafana if needed
docker compose restart grafana# Check if Prometheus is running
docker compose ps prometheus
# Test Prometheus endpoint
curl http://localhost:9090/api/v1/query?query=up
# Check Prometheus logs
docker compose logs prometheus# Check if tracker metrics endpoint is working
curl http://localhost:1212/metrics
# Verify tracker is processing requests
# Make some announce requests to generate metrics- Verify JSON syntax is valid
- Check that the data source UID matches your Prometheus configuration
- Try importing individual panels instead of the full dashboard
- Grafana Documentation: https://grafana.com/docs/
- Prometheus Documentation: https://prometheus.io/docs/
- Project Issues: GitHub Issues
After setting up Grafana:
- Configure Alerting (optional): Set up alerts for critical metrics
- Create User Accounts (optional): Add additional users for team access
- Customize Dashboards: Modify imported dashboards to fit your needs
- Set Up Long-term Storage (optional): Configure long-term metrics retention
- Change default passwords immediately
- Restrict network access to Grafana (firewall rules)
- Use HTTPS for production deployments
- Regular backups of dashboard configurations
- Monitor access logs for unauthorized access attempts
By default, Grafana runs on port 3100. In production:
- Consider putting Grafana behind a reverse proxy
- Use HTTPS with proper SSL certificates
- Implement proper authentication (OAuth, LDAP, etc.)
- Restrict access to monitoring networks only
This guide provides the essential steps for setting up Grafana monitoring for your Torrust Tracker deployment. The manual setup process allows for flexibility in customizing your monitoring solution to meet specific requirements.
While the basic setup is straightforward, Grafana offers extensive customization options for advanced users who want to create sophisticated monitoring and alerting systems.