Most servers get monitored after the first outage. By then you're reading logs to find out what happened, when an alert could have told you an hour earlier that the disk was filling up.
This guide sets up a small monitoring stack in one Docker Compose file : node_exporter collects host metrics, Prometheus stores them and evaluates alert rules, Alertmanager sends the alerts (Telegram or email), and Grafana draws the dashboards. Then it adds the five alert rules worth starting with, and leaves out the rest.
You need a Linux server with Docker Engine and the Compose plugin ( docker compose version should work).
The layout
monitoring/ ├── docker-compose.yml ├── prometheus/ │ ├── prometheus.yml │ └── alerts.yml └── alertmanager/ └── alertmanager.yml
Enter fullscreen mode
Exit fullscreen mode
Step 1: docker-compose.yml
services : prometheus : image : prom/prometheus:v2.53.0 volumes : - ./prometheus:/etc/prometheus:ro - prometheus-data:/prometheus command : - --config.file=/etc/prometheus/prometheus.yml -…