Running a VPS without monitoring is like driving a car without a dashboard — you won't know you're running out of fuel until the engine stops. This guide walks you through installing Netdata (simple and fast) or Prometheus + Grafana (powerful and flexible) on Ubuntu VPS, step by step.
Without monitoring, you won't discover problems until your website is already down. The most common VPS failure scenarios:
| Feature | Netdata | Prometheus + Grafana |
|---|---|---|
| Installation difficulty | ⭐⭐⭐⭐⭐ Very easy (1 command) | ⭐⭐⭐ Multi-step setup |
| Real-time Dashboard | ✅ Instant UI included | ❌ Requires dashboard import |
| Flexibility | Moderate | ⭐⭐⭐⭐⭐ Very high |
| Long-term storage | Limited (default 24h) | ✅ Configurable retention |
| Resource usage | ~50-100 MB RAM | ~300-700 MB RAM |
| Multi-server | Netdata Cloud (free) | ✅ Native support |
| Best for | Single VPS, beginners | Clusters, large production |
Free Ubuntu 20.04/22.04/24.04
Netdata provides a one-line installer that detects your OS and installs automatically:
# Update package list first
sudo apt update
# Install Netdata with one-line installer
wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh
sh /tmp/netdata-kickstart.sh --stable-channel --no-updates
Verify the service is running:
sudo systemctl status netdata
# Should show: active (running)
Open the dashboard at http://YOUR_VPS_IP:19999 — real-time graphs appear immediately.
# Add Netdata repository
curl -s https://packagecloud.io/install/repositories/netdata/netdata/script.deb.sh | sudo bash
# Install
sudo apt install netdata -y
# Enable and start
sudo systemctl enable netdata
sudo systemctl start netdata
Edit /etc/netdata/netdata.conf:
[web]
# Allow only localhost (use SSH tunnel to access)
bind to = 127.0.0.1
# Or specify allowed IPs
allow connections from = localhost 192.168.1.*
sudo systemctl restart netdata
# Run on your local machine
ssh -L 19999:127.0.0.1:19999 user@YOUR_VPS_IP
# Then open in browser:
# http://localhost:19999
sudo nano /etc/netdata/health_alarm_notify.conf
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="[email protected]"
SENDMAIL="$(which sendmail)"
Prometheus requires two components: Prometheus itself (metric storage) and Node Exporter (OS metric collection).
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz
sudo cp node_exporter-1.8.2.linux-amd64/node_exporter /usr/local/bin/
# Create service user
sudo useradd -rs /bin/false node_exporter
Create systemd service file:
sudo nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
# Verify: curl http://localhost:9100/metrics | head -20
cd /tmp
wget https://github.com/prometheus/prometheus/releases/download/v2.54.1/prometheus-2.54.1.linux-amd64.tar.gz
tar xvf prometheus-2.54.1.linux-amd64.tar.gz
sudo useradd -rs /bin/false prometheus
sudo mkdir /etc/prometheus /var/lib/prometheus
sudo cp prometheus-2.54.1.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.54.1.linux-amd64/promtool /usr/local/bin/
sudo cp -r prometheus-2.54.1.linux-amd64/consoles /etc/prometheus
sudo cp -r prometheus-2.54.1.linux-amd64/console_libraries /etc/prometheus
Configure Prometheus:
sudo nano /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['localhost:9100']
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
Create systemd service:
sudo nano /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
After=network.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--storage.tsdb.retention.time=30d \
--web.listen-address=127.0.0.1:9090
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheus
sudo apt install -y apt-transport-https software-properties-common wget
sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | \
sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt update
sudo apt install grafana -y
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
Use SSH tunnel: ssh -L 3000:127.0.0.1:3000 user@VPS_IP then open http://localhost:3000
admin, Password admin — change immediately!http://localhost:90901860 (Node Exporter Full — most popular dashboard)You'll instantly have a beautiful dashboard showing CPU, RAM, Disk, and Network metrics.
| Metric | Normal Range | Alert Threshold |
|---|---|---|
| CPU Usage | < 70% | > 90% for 5+ minutes |
| RAM Usage | < 80% | > 90% (OOM risk) |
| Disk Usage | < 70% | > 85% (plan cleanup) |
| Disk I/O Wait | Workload-dependent | > 20% sustained |
| Network In/Out | Normal usage baseline | Unusual spikes |
| Load Average | < number of CPUs | > 2× CPU core count |
| Swap Usage | 0-20% | > 50% (insufficient RAM) |
Netdata includes many pre-configured alerts in /etc/netdata/health.d/. Customize thresholds as needed:
# /etc/netdata/health.d/cpu.conf
alarm: cpu_usage
on: system.cpu
lookup: average -1m percentage of user,system
units: %
warn: $this > 80
crit: $this > 95
info: CPU usage is high
Monitoring dashboards expose sensitive server information and must never be publicly accessible.
# Access Netdata
ssh -L 19999:127.0.0.1:19999 user@VPS_IP &
# Access Grafana
ssh -L 3000:127.0.0.1:3000 user@VPS_IP &
sudo apt install -y nginx apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd admin
# /etc/nginx/sites-available/netdata
server {
listen 80;
server_name monitor.yourdomain.com;
auth_basic "Monitoring";
auth_basic_user_file /etc/nginx/.htpasswd;
location / {
proxy_pass http://127.0.0.1:19999;
proxy_set_header Host $host;
}
}
sudo ufw deny 19999
sudo ufw deny 9090
sudo ufw deny 3000
sudo ufw allow from YOUR_IP_ADDRESS to any port 19999
Related Articles: Configure UFW Firewall on VPS • Create systemd Service • Grafana + Prometheus on VPS