Production-grade centralized monitoring platform using Docker Compose.
| Component | Version | Purpose |
|---|---|---|
| Prometheus | v2.53.0 | Metrics collection and storage |
| Grafana | v11.1.0 | Visualization and dashboards |
| Alertmanager | v0.33.1 | Alert routing and notification |
| Loki | v3.7.4 | Log aggregation |
| Promtail | v3.6.11 | Log collector |
| Node Exporter | v1.12.1 | Host system metrics |
| cAdvisor | v0.49.1 | Container metrics |
| Blackbox Exporter | v0.28.0 | Endpoint probing |
# 1. Copy and configure environment variables
cp .env.example .env
nano .env # Edit credentials and settings
# 2. Deploy the stack
./scripts/deploy.sh
# 3. Validate deployment
./scripts/validate.sh| Service | URL | Credentials |
|---|---|---|
| Grafana | http://localhost:3000 | Configured in .env |
| Prometheus | http://localhost:9090 | - |
| Alertmanager | http://localhost:9093 | - |
monitoring-platform/
├── docker-compose.yml # Main compose file
├── .env.example # Environment variables template
├── .env # Your credentials (git-ignored)
├── prometheus/
│ ├── prometheus.yml # Prometheus configuration
│ └── alert.rules.yml # Alert rules
├── alertmanager/
│ ├── Dockerfile # Custom image with envsubst
│ ├── entrypoint.sh # Config template processor
│ └── alertmanager.yml.tmpl # Alertmanager config template
├── grafana/
│ └── provisioning/
│ ├── datasources/ # Auto-configured datasources
│ └── dashboards/ # Dashboard provisioning
├── loki/
│ └── loki-config.yml # Loki configuration
├── promtail/
│ └── promtail-config.yml # Promtail configuration
├── blackbox-exporter/
│ └── blackbox.yml # Blackbox probe modules
├── scripts/
│ ├── deploy.sh # Deployment script
│ ├── validate.sh # Validation script
│ ├── backup.sh # Backup script
│ └── restore.sh # Restore script
└── docs/
└── DEPLOYMENT.md # Deployment guide
All credentials and configurable settings are centralized in .env file.
| Variable | Description | Default |
|---|---|---|
GRAFANA_ADMIN_USER |
Admin username | admin |
GRAFANA_ADMIN_PASSWORD |
Admin password | admin |
GRAFANA_ROOT_URL |
Public URL for Grafana | http://localhost:3000 |
| Variable | Description | Default |
|---|---|---|
PROMETHEUS_RETENTION_TIME |
How long to keep metrics | 30d |
PROMETHEUS_RETENTION_SIZE |
Max storage size | 10GB |
| Variable | Description | Example |
|---|---|---|
SMTP_SMARTHOST |
SMTP server:port | smtp.gmail.com:587 |
SMTP_FROM |
Sender email address | alerts@example.com |
SMTP_AUTH_USERNAME |
SMTP username | alerts@example.com |
SMTP_AUTH_PASSWORD |
SMTP password/app password | your-app-password |
SMTP_REQUIRE_TLS |
Require TLS | true |
ALERT_EMAIL_TO |
Alert recipient email | oncall@example.com |
| Variable | Description | Example |
|---|---|---|
SLACK_API_URL |
Slack webhook URL | https://hooks.slack.com/... |
SLACK_CHANNEL_CRITICAL |
Channel for critical alerts | #alerts-critical |
SLACK_CHANNEL_WARNING |
Channel for warning alerts | #alerts-warning |
./scripts/deploy.sh./scripts/validate.sh./scripts/backup.sh [backup_directory]./scripts/restore.sh <backup_file.tar.gz>docker compose down# All services
docker compose logs -f
# Specific service
docker compose logs -f prometheus- Change default credentials - Update Grafana admin password immediately
- Firewall - Only ports 3000, 9090, 9093 are exposed; restrict access via firewall
- Exporters - Node Exporter, cAdvisor, Blackbox Exporter are internal only
- Network - All services communicate via internal Docker network
Edit prometheus/prometheus.yml and add new targets under scrape_configs.
Edit prometheus/alert.rules.yml to add new alerting rules.
Edit alertmanager/alertmanager.yml to configure email, Slack, or webhook receivers.
Edit prometheus/prometheus.yml under the blackbox-http job to add endpoints to monitor.
docker compose psdocker compose logs <service_name>docker compose restart <service_name>curl -X POST http://localhost:9090/-/reload