Install Netdata on VPS for Real-time Monitoring
Netdata is an open-source monitoring agent that collects metrics every 1 second and displays them through a real-time web dashboard — view CPU, RAM, Disk I/O, Network, Process, Container, and Application metrics all in one place without needing to set up a complex database or pipeline. Unlike Prometheus+Grafana which require multiple layers of configuration, Netdata installs with a single command and works immediately. This guide covers installation, setting up alerts, securing the dashboard, and exporting metrics to Grafana.
Why Use Netdata?
- 1-second Real-time: See problems the moment they happen without waiting for scrape intervals
- Easy Installation: Single script handles everything and supports Ubuntu/Debian/CentOS
- Auto-detect: Automatically discovers Nginx, MySQL, Docker, Redis and other services
- Low Memory: Uses approximately 100–200 MB of RAM while storing hours of historical data
- Built-in Alerts: Includes 200+ default rules and can send alerts to email/Slack/PagerDuty
Install Netdata
# Method 1 — Official installer script (recommended)
wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh
sh /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry
# Method 2 — Install from apt (Ubuntu/Debian)
apt install -y netdata
# Enable and start the service
systemctl enable netdata
systemctl start netdata
# Netdata listens on port 19999 by default
# Open in browser: http://YOUR_VPS_IP:19999
Secure the Dashboard from Public Access
Netdata's default configuration opens port 19999 to everyone. You must secure this immediately using a reverse proxy.
# Edit the config file
nano /etc/netdata/netdata.conf
# Add to [web] section
[web]
bind to = 127.0.0.1
# Restart Netdata
systemctl restart netdata
Set Up Nginx Reverse Proxy with Authentication
# Create password file
apt install -y apache2-utils
htpasswd -c /etc/nginx/.netdata_auth admin
# Create Nginx vhost
nano /etc/nginx/sites-available/netdata
server {
listen 80;
server_name monitor.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name monitor.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/monitor.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/monitor.yourdomain.com/privkey.pem;
auth_basic "Netdata Monitoring";
auth_basic_user_file /etc/nginx/.netdata_auth;
location / {
proxy_pass http://127.0.0.1:19999;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Enable and reload
ln -s /etc/nginx/sites-available/netdata /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
Enable Additional Plugins and Monitoring
Netdata auto-detects many services, but some require additional configuration:
# MySQL Monitoring — Create user for Netdata to read metrics
mysql -u root -p -e "CREATE USER 'netdata'@'localhost' IDENTIFIED BY '';
GRANT USAGE ON *.* TO 'netdata'@'localhost';
FLUSH PRIVILEGES;"
# Edit plugin config
nano /etc/netdata/python.d/mysql.conf
# Add:
# localhost:
# 'user': 'netdata'
# 'pass': ''
# 'my.cnf': '/etc/mysql/my.cnf'
# Docker container monitoring
# Netdata auto-detects Docker if socket /var/run/docker.sock is accessible
usermod -aG docker netdata
systemctl restart netdata
Configure Alert Notifications
# View active alerts
/etc/netdata/health.d/
# Set up email alerts
nano /etc/netdata/health_alarm_notify.conf
# Edit email section:
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="[email protected]"
SENDMAIL=/usr/sbin/sendmail
# Set up Slack webhook
SEND_SLACK="YES"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"
DEFAULT_RECIPIENT_SLACK="#alerts"
# Test the alert
su -s /bin/bash netdata -c "/usr/libexec/netdata/plugins.d/alarm-notify.sh test"
Export Metrics to Prometheus + Grafana
# Enable Prometheus exporter in Netdata
nano /etc/netdata/exporting.conf
[prometheus:local]
enabled = yes
destination = localhost:9091
# Or use native Prometheus endpoint directly at:
# http://127.0.0.1:19999/api/v1/allmetrics?format=prometheus
# Add scrape config to Prometheus
# prometheus.yml:
# - job_name: 'netdata'
# static_configs:
# - targets: ['localhost:19999']
# metrics_path: '/api/v1/allmetrics'
# params:
# format: [prometheus]
# Import Grafana dashboard ID 7107 (Netdata Overview)
# Or ID 2701 (popular Netdata dashboard)
Configure Log Retention to Reduce Memory Usage
# Edit history and memory mode
nano /etc/netdata/netdata.conf
[global]
# Store 6 hours of history (default = 3600 seconds)
history = 21600
# Use dbengine instead of RAM to store longer history
memory mode = dbengine
[db]
# Disk space for dbengine (MB)
dbengine multihost disk space MB = 512
systemctl restart netdata
Verify Netdata is Working Correctly
# Check service status
systemctl status netdata
# Verify listening port (should show 127.0.0.1:19999 after config change)
ss -tlnp | grep 19999
# Check for errors
journalctl -u netdata -n 50
# Test API health endpoint
curl -s http://127.0.0.1:19999/api/v1/info | python3 -m json.tool | head -20
# View all collected metrics
curl -s "http://127.0.0.1:19999/api/v1/charts" | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Charts: {len(d[\"charts\"])}')"
/etc/netdata/python.d.conf or /etc/netdata/node.d.conf. Each plugin can be individually disabled with enabled: noCommon Issues & Troubleshooting
Error: "Cannot open /proc/net/dev"
This occurs when the kernel lacks procfs or when container privileges are too restricted.
# Check if procfs is mounted
ls /proc/net/dev
# For Docker containers, run with --cap-add SYS_PTRACE
docker run -d \
--cap-add SYS_PTRACE \
--pid=host \
--network=host \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
netdata/netdata
Error: "netdata: command not found" After Installation
The installer adds a new PATH at /opt/netdata/usr/sbin/ — you need to reload your shell.
export PATH=$PATH:/opt/netdata/usr/sbin
# Or logout and login again
# Check actual location
which netdata || find /opt /usr -name netdata -type f 2>/dev/null
Error: "Permission denied" for MySQL Plugin
The netdata user lacks permission to read MySQL stats.
mysql -u root -p -e "GRANT USAGE ON *.* TO 'netdata'@'localhost'; FLUSH PRIVILEGES;"
# Verify
mysql -u netdata -e "SHOW GLOBAL STATUS LIMIT 5;"
Dashboard Loads Slowly or Charts Are Missing
Usually caused by browser cache or proxy not forwarding WebSocket connections.
# Add to Nginx location block
location / {
proxy_pass http://127.0.0.1:19999;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
}
Netdata Uses Too Much RAM
Default configuration stores metrics in RAM. On low-memory servers, change to disk mode.
nano /etc/netdata/netdata.conf
[global]
memory mode = save # Write to disk instead of RAM
history = 3600 # Reduce history to 1 hour
systemctl restart netdata
# Check RAM after restart
ps aux | grep netdata | awk '{print $6}' | head -5
Frequently Asked Questions
How does Netdata compare to Grafana+Prometheus?
Netdata excels at real-time troubleshooting — see data in 1-second intervals, easy setup, no complex pipeline. Prometheus+Grafana is better for long-term trend analysis, multi-server aggregation, and complex custom dashboards. They work together: Netdata exports metrics that Prometheus can scrape.
Does Netdata send data to the internet?
No by default — --disable-telemetry turns off telemetry during installation. If you use Netdata Cloud, you authenticate with a claim token, but metrics stay on your VPS and aren't uploaded to the cloud.
Does Netdata support container monitoring?
Yes, it automatically detects Docker and LXC/LXD containers — view CPU/RAM per container and see per-container network/disk I/O. Kubernetes requires a separate Netdata Helm chart.