diff --git a/README.md b/README.md index c2a050d..7ab611a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,138 @@ -# docker-monitoring -Docker Monitoring Setup +# ๐Ÿ”ญ Observability Stack with Prometheus, Grafana, Loki, Promtail, and Node Exporter + +This project sets up a complete monitoring and logging stack using Docker Compose. + +## ๐Ÿš€ Stack Components + +- **Prometheus** โ€“ Metrics collection and alerting +- **Grafana** โ€“ Visualization and dashboarding +- **Loki** โ€“ Log aggregation system by Grafana +- **Promtail** โ€“ Log shipping agent for Loki +- **Node Exporter** โ€“ Host-level metrics for Prometheus + +--- + +## ๐Ÿ“ฆ Getting Started + +### 1. Clone the Repository + +```bash +git clone https://github.com/yourusername/docker-monitoring.git +cd docker-monitoring +``` + + +### 2. Start All Services + +``` +docker compose up -d +``` + +This will pull all required images and start the containers in the background. + +--- + +## ๐ŸŒ Accessing the Services + +| Service | URL | Default Credentials | +|---|---|---| +| Grafana | [http://localhost:3000](http://localhost:3000) | **admin / admin** | +| Prometheus | [http://localhost:9090](http://localhost:9090) | N/A | +| Loki | [http://localhost:3100](http://localhost:3100) | N/A | +| Node Exporter | [http://localhost:9100](http://localhost:9100) | N/A | + +--- + +## ๐Ÿ“Š Grafana Dashboards + +### 1. Log in to Grafana + +Visit [http://localhost:3000](http://localhost:3000) and log in with: + +``` +Username: admin +Password: admin +``` + +### 2. Add Data Sources + +If not auto-provisioned, configure the following: + +* **Prometheus** at `http://prometheus:9090` + +* **Loki** at `http://loki:3100` + +### 3. Import Dashboards + +You can import dashboards from Grafana.com: + +* **Node Exporter Full** (ID: `1860`) + +* **Loki Logs Dashboard** (ID: `13665`) + +--- + +## ๐Ÿ”ง Configuration Files + +* `prometheus/prometheus.yml` โ€“ Prometheus scrape configuration + +* `promtail/config.yml` โ€“ Promtail log collection rules + +* `grafana/provisioning/` โ€“ Optional folder to auto-provision data sources/dashboards + +--- + +## ๐Ÿ“ฅ Logs and Metrics Locations + +* Promtail reads logs from `/var/log` and `/var/lib/docker/containers` + +* Node Exporter reads system metrics from host via `/proc`, `/sys`, and root FS + +--- + +## ๐Ÿงผ Stop and Cleanup + +``` +docker compose down +``` + +To remove all volumes and start fresh: + +``` +docker compose down -v +``` + +--- + +## ๐Ÿง  Tip + +Make sure Docker has access to system folders (`/var/log`, `/var/lib/docker`, `/proc`, etc.) and your user has permission to bind to these files on macOS/Linux. + +--- + +## ๐Ÿ› ๏ธ Troubleshooting + +* Check logs: + +``` +docker compose logs -f +``` + +* Verify Prometheus targets: +* Go to **Status > Targets** in Prometheus UI + +* Grafana dashboards not showing data? Check: + + * Data source config + + * Time range in dashboard + + * Prometheus targets scraping successfully + +--- + +## ๐Ÿ“Ž License +Apache 2 + + +#courses/docker/labs-v2