A comprehensive Docker-based monitoring solution using Prometheus, Grafana, Alertmanager, and Node Exporter for system monitoring and alerting.
This project provides a complete monitoring stack that includes:
- Prometheus: Time-series database for metrics collection
- Grafana: Visualization and dashboard platform
- Alertmanager: Alert routing and notification management
- Node Exporter: System metrics exporter for Prometheus
- Docker
- Docker Compose
- At least 2GB of available RAM
- Ports 3000, 9090, 9093, and 9100 available
-
Clone the repository
git clone <repository-url> cd Docker-monitoring
-
Configure Alertmanager (Optional) Edit
alertmanager/config.yamlto add your Slack webhook URL:global: slack_api_url: "your-slack-webhook-url"
-
Start the monitoring stack
docker-compose up -d
Once the stack is running, you can access the following services:
| Service | URL | Default Credentials |
|---|---|---|
| Grafana | http://localhost:3000 | admin/admin |
| Prometheus | http://localhost:9090 | None |
| Alertmanager | http://localhost:9093 | None |
| Node Exporter | http://localhost:9100 | None |
- Scrape Interval: 15 seconds
- Evaluation Interval: 15 seconds
- Targets: Prometheus itself and Node Exporter
The system includes basic alert rules for:
- Instance down detection (5-minute threshold)
- Critical severity classification
- Configured for Slack notifications
- Route configuration for alert distribution
- Channel: #alerts
To monitor additional services, edit prometheus/prometheus.yaml:
scrape_configs:
- job_name: 'your-service'
static_configs:
- targets:
- 'your-service:port'Add new alert rules in prometheus/alert.rules.yaml:
- alert: your_alert_name
expr: your_promql_expression
for: 5m
labels:
severity: warning
annotations:
summary: "Alert summary"
description: "Detailed description"- Access Grafana at http://localhost:3000
- Login with admin/admin
- Add Prometheus as a data source:
- URL:
http://prometheus:9090 - Access: Server (default)
- URL:
- Import dashboards or create your own
The system is configured to send alerts to Slack when:
- Instances go down for more than 5 minutes
- Other conditions defined in alert rules
To configure Slack notifications:
- Create a Slack app and get the webhook URL
- Update
alertmanager/config.yaml - Restart the alertmanager service
docker-compose downTo remove all data:
docker-compose down -vDocker-monitoring/
├── docker-compose.yml # Main orchestration file
├── prometheus/
│ ├── prometheus.yaml # Prometheus configuration
│ └── alert.rules.yaml # Alert rules
├── alertmanager/
│ └── config.yaml # Alertmanager configuration
└── README.md # This file
- Port conflicts: Ensure ports 3000, 9090, 9093, and 9100 are available
- Permission issues: Run with appropriate Docker permissions
- Configuration errors: Check YAML syntax in config files
View logs for specific services:
docker-compose logs prometheus
docker-compose logs grafana
docker-compose logs alertmanager