This project provides a complete monitoring stack for Docker containers using:
✅ cAdvisor - Collects real-time container metrics
✅ Prometheus - Stores and queries time-series data
✅ Grafana - Visualizes metrics with interactive dashboards
With this setup, you can track CPU, memory, disk, and network usage for your containers in real time! 🚀
📂 monitoring/
├── 📜 docker-compose.yml # Defines cAdvisor, Prometheus, and Grafana services
├── 📜 prometheus.yml # Prometheus scrape configuration
├── 📜 datasources.yml # Grafana data source config (auto-connects Prometheus)
├── 📜 dashboard.json # Pre-configured Grafana dashboard
├── 📜 default.yaml # Grafana dashboard provisioning
git clone https://github.com/hasnain393/docker-observability.git
cd docker-monitoring-stackdocker compose up -dThis will start:
✅ cAdvisor → http://localhost:8080
✅ Prometheus → http://localhost:9090
✅ Grafana → http://localhost:3000 (Login: admin / admin)
1️⃣ Open Grafana → http://localhost:3000
2️⃣ Go to Dashboards → Import
3️⃣ Upload dashboard.json or Docker Monitoring Test.json
4️⃣ Enjoy real-time container metrics! 🚀
🔹 CPU Usage:
rate(container_cpu_usage_seconds_total{container_label_com_docker_compose_service="your-container-name"}[5m])
🔹 Memory Usage:
container_memory_usage_bytes{container_label_com_docker_compose_service="your-container-name"}
🔹 Network I/O:
rate(container_network_transmit_bytes_total{container_label_com_docker_compose_service="your-container-name"}[5m])
- Check if cAdvisor is running:
docker ps | grep cadvisor - Verify Prometheus is scraping cAdvisor:
curl http://localhost:8080/metrics | grep container_cpu_usage_seconds_total - Restart services:
docker-compose restart prometheus cadvisor
This project is open-source under the MIT License. Feel free to contribute!
- Fork the repo & submit PRs 🤝
- Share with the DevOps community 🚀



