This stack provides basic monitoring and visualization using Prometheus and Grafana. Prometheus collects metrics and Grafana renders dashboards from Prometheus data.
flowchart LR
Node([VPS / VM]) --> NodeExp[Node Exporter :9100]
NodeExp --> Prometheus[Prometheus :9090]
Prometheus --> Grafana[Grafana :3000]
- Prometheus starts with local scrape config from
prometheus/prometheus.yml. - Prometheus stores time-series metrics in persistent storage.
- Grafana auto-loads a Prometheus datasource via provisioning.
- You query and visualize metrics in Grafana dashboards.
-
Prometheus image:
prom/prometheus:latest -
Grafana image:
grafana/grafana:latest -
Prometheus UI:
http://<host-ip>:9090 -
Grafana UI:
http://<host-ip>:3000 -
Persistent data:
prometheus_data:/prometheusgrafana_data:/var/lib/grafana
-
Mounted config:
./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml./grafana/provisioning:/etc/grafana/provisioning
This setup works well with Grafana dashboard ID: 1860 (Node Exporter Full).
- Dashboard: https://grafana.com/grafana/dashboards/1860
- Use it to monitor:
- CPU usage
- Memory usage
- Disk I/O
- Network traffic
- System load
- Open Grafana → Dashboards → Import
- Enter ID:
1860 - Select Prometheus datasource
- Click Import
Copy .env.example to .env:
GF_SECURITY_ADMIN_USERGF_SECURITY_ADMIN_PASSWORDGF_USERS_ALLOW_SIGN_UP
From the repository root:
cd grafana-prometheus-node
cp .env.example .env
docker compose up -dOpen:
- Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000
docker compose ps
docker compose logs -f
docker compose restart
docker compose downTo monitor a VPS or VM, use Node Exporter on port 9100.
Install Node Exporter on your VPS/VM:
wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-*.linux-amd64.tar.gzExtract and run (example):
tar -xvf node_exporter-*.linux-amd64.tar.gz
cd node_exporter-*.linux-amd64
./node_exporterBy default it exposes metrics on:
http://<vps-ip>:9100/metrics
Update prometheus/prometheus.yml:
- job_name: "vps-vms"
static_configs:
- targets: ["vps-or-vm:9100"]Guidelines:
- Replace
vps-or-vmwith your actual server IP or hostname. - Ensure port
9100is accessible (firewall/security group). - Node Exporter must be running on the VPS/VM.
- Restart Prometheus after config changes:
docker compose restart prometheus- Change default Grafana credentials before exposing this stack.
- You can add additional scrape targets in
prometheus/prometheus.yml. - Using Grafana dashboard 1860 is strongly recommended for system-level monitoring.