How to set up Prometheus and Grafana for metrics
Updated 7/20/2026
Prometheus and Grafana are the industry standard for monitoring. Prometheus collects and stores metrics, and Grafana turns them into clear dashboards.
How they connect
- An "exporter" (for example node_exporter) exposes the server's metrics.
- Prometheus scrapes them periodically and stores them.
- Grafana connects to Prometheus and draws them.
1. Start with Docker Compose
services:
prometheus:
image: prom/prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
grafana:
image: grafana/grafana
ports:
- "3000:3000"
docker compose up -d
2. Configure Prometheus
In prometheus.yml, you add the targets it scrapes metrics from (the servers running node_exporter).
3. Connect Grafana
In Grafana (port 3000), you add Prometheus as a data source, then import a ready-made dashboard (there are many free ones for node_exporter).
Securing it
Put both behind a reverse proxy with HTTPS and authentication, see Nginx as a reverse proxy. For something simpler, see Netdata.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to monitor database performance
See slow queries, connections and database usage, to keep it fast.
Updated 7/20/2026Monitoring & loggingHow to monitor disk space and avoid running out
A full disk stops services and corrupts data. Here is how to track space and get alerts in time.
Updated 7/20/2026Monitoring & loggingHow to monitor a website and SSL expiry
Do not let your site go down or your SSL certificate expire without knowing. Here is how to track them automatically.
Updated 7/20/2026