Set up Netdata for comprehensive real-time monitoring of CPU, memory, disk, and network resources with a web-based dashboard, email alerts, and customizable thresholds.
Prerequisites
- Root or sudo access
- Minimum 1GB RAM
- Open port 19999
- Email server or mail utility
What this solves
Netdata provides real-time system monitoring with an intuitive web dashboard that tracks CPU usage, memory consumption, disk I/O, network traffic, and application performance metrics. It offers zero-configuration installation with automatic service discovery, microsecond resolution data collection, and built-in alerting capabilities for proactive system management.
Step-by-step installation
Update system packages
Start by updating your package manager to ensure you get the latest versions of dependencies.
sudo apt update && sudo apt upgrade -y
Install required dependencies
Install essential packages needed for Netdata compilation and operation.
sudo apt install -y curl wget git build-essential autoconf automake pkg-config zlib1g-dev libssl-dev libuv1-dev cmake libjson-c-dev libelf-dev liblz4-dev
Download and install Netdata
Use the official Netdata installation script which automatically detects your system and installs the latest stable version.
curl -Ss https://get.netdata.cloud/kickstart.sh | bash -s -- --stable-channel --disable-telemetry
Enable and start Netdata service
Configure Netdata to start automatically on boot and verify the service status.
sudo systemctl enable netdata
sudo systemctl start netdata
sudo systemctl status netdata
Configure firewall access
Open port 19999 to allow web dashboard access from your network.
sudo ufw allow 19999/tcp
sudo ufw reload
Configure web dashboard access
Secure web interface access
Configure Netdata to accept connections from your network by editing the main configuration file.
sudo mkdir -p /etc/netdata
sudo /usr/libexec/netdata/edit-config netdata.conf
Configure bind settings
Modify the web section to allow access from your local network. Replace 203.0.113.0/24 with your actual network range.
[web]
bind to = *
allow connections from = localhost 127.0.0.1 ::1 203.0.113.0/24
allow management from = localhost 127.0.0.1
[global]
update every = 1
memory mode = dbengine
page cache size = 32
dbengine disk space = 256
Create authentication for web access
Set up basic HTTP authentication to secure the dashboard.
sudo htpasswd -c /etc/netdata/netdata.htpasswd admin
Enable authentication in configuration
Add authentication settings to the web section of the configuration.
[web]
bind to = *
allow connections from = localhost 127.0.0.1 ::1 203.0.113.0/24
allow management from = localhost 127.0.0.1
enable gzip compression = yes
web files owner = netdata
web files group = netdata
Restart Netdata service
Apply the configuration changes by restarting the service.
sudo systemctl restart netdata
sudo systemctl status netdata
Set up email alerts for critical metrics
Install email notification dependencies
Install mailutils or postfix for email functionality.
sudo apt install -y mailutils
Configure health alert settings
Create a custom health configuration file to define email notification settings.
sudo /usr/libexec/netdata/edit-config health_alarm_notify.conf
Set up email notification parameters
Configure the email settings for alert notifications. Replace admin@example.com with your actual email address.
# Email configuration
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="admin@example.com"
EMAIL_SENDER="netdata@example.com"
Email command (adjust based on your mail system)
SENDMAIL="/usr/bin/mail"
Enable notifications for specific roles
role_recipients_email[sysadmin]="admin@example.com"
role_recipients_email[webmaster]="webmaster@example.com"
Test email notifications
Test the email notification system to ensure alerts will be delivered.
sudo -u netdata /usr/libexec/netdata/plugins.d/alarm-notify.sh test
Customize monitoring thresholds and notifications
Create custom health configuration
Create a custom health configuration file for system-specific monitoring thresholds.
sudo mkdir -p /etc/netdata/health.d
sudo nano /etc/netdata/health.d/custom.conf
Configure CPU usage alerts
Set up custom CPU monitoring thresholds with different severity levels.
# CPU usage alerts
alarm: cpu_usage_high
on: system.cpu
calc: $user + $system + $nice + $iowait
units: %
every: 10s
warn: $this > 80
crit: $this > 95
delay: down 5m multiplier 1.5 max 1h
info: system CPU utilization is high
to: sysadmin
Memory usage alerts
alarm: memory_usage_high
on: system.ram
calc: ($used) * 100 / ($used + $free + $buffers + $cache)
units: %
every: 10s
warn: $this > 80
crit: $this > 90
delay: down 5m multiplier 1.5 max 1h
info: system memory utilization is high
to: sysadmin
Configure disk space alerts
Add disk space monitoring for critical partitions.
# Disk space alerts
alarm: disk_space_usage
on: disk_space.used
calc: $used * 100 / ($avail + $used)
units: %
every: 1m
warn: $this > 80
crit: $this > 90
delay: down 15m multiplier 1.5 max 2h
info: disk space utilization is high
to: sysadmin
Load average alerts
alarm: load_average_high
on: system.load
lookup: average -10m unaligned of load1
units: load
every: 1m
warn: $this > 2
crit: $this > 4
delay: down 15m multiplier 1.5 max 1h
info: system load average is high
to: sysadmin
Configure network monitoring
Set up alerts for network interface issues and high traffic.
# Network interface down alert
alarm: network_interface_down
on: net.operstate
calc: $up
units: boolean
every: 10s
crit: $this != 1
delay: down 5m multiplier 1.5 max 1h
info: network interface is down
to: sysadmin
High network traffic alert
alarm: network_traffic_high
on: net.net
calc: abs($received) + abs($sent)
units: kilobits/s
every: 10s
warn: $this > 80000
crit: $this > 100000
delay: down 15m multiplier 1.5 max 1h
info: network traffic is unusually high
to: sysadmin
Reload health configuration
Apply the new health monitoring configuration without restarting Netdata.
sudo netdatacli reload-health
sudo systemctl reload netdata
Verify your setup
sudo systemctl status netdata
sudo netstat -tlnp | grep 19999
curl -I http://localhost:19999
sudo netdatacli ping
Access your Netdata dashboard by opening http://your-server-ip:19999 in your web browser. You should see real-time metrics for CPU, memory, disk, network, and running processes.
Common issues
| Symptom | Cause | Fix |
|---|---|---|
| Dashboard not accessible | Firewall blocking port 19999 | Check firewall rules: sudo ufw status or sudo firewall-cmd --list-ports |
| Service fails to start | Configuration syntax error | Check config syntax: sudo netdata -W unittest |
| Email alerts not working | Mail system not configured | Test mail: echo "test" | mail -s "Test" admin@example.com |
| High memory usage | Default memory settings too high | Reduce dbengine page cache size in netdata.conf |
| Missing metrics | Required packages not installed | Install missing dependencies based on plugin requirements |
| Permission denied errors | Netdata user lacks access | Add netdata user to required groups: sudo usermod -a -G docker,adm netdata |
Next steps
Automated install script
Run this to automate the entire setup
#!/usr/bin/env bash
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Global variables
NETWORK_RANGE=""
ADMIN_EMAIL=""
# Usage function
usage() {
echo "Usage: $0 [--network NETWORK_RANGE] [--email EMAIL]"
echo " --network: Network range for web access (e.g., 192.168.1.0/24)"
echo " --email: Admin email for alerts (e.g., admin@example.com)"
echo "Example: $0 --network 192.168.1.0/24 --email admin@example.com"
exit 1
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--network)
NETWORK_RANGE="$2"
shift 2
;;
--email)
ADMIN_EMAIL="$2"
shift 2
;;
-h|--help)
usage
;;
*)
echo -e "${RED}Unknown option: $1${NC}"
usage
;;
esac
done
# Cleanup function for rollback
cleanup() {
echo -e "${YELLOW}Installation failed. Performing cleanup...${NC}"
systemctl stop netdata 2>/dev/null || true
systemctl disable netdata 2>/dev/null || true
}
# Set trap for cleanup on error
trap cleanup ERR
# Check if running as root or with sudo
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}This script must be run as root or with sudo${NC}"
exit 1
fi
# Auto-detect distribution
echo -e "${BLUE}[1/10] Detecting distribution...${NC}"
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
ubuntu|debian)
PKG_MGR="apt"
PKG_UPDATE="apt update && apt upgrade -y"
PKG_INSTALL="apt install -y"
FIREWALL_CMD="ufw"
MAIL_PACKAGE="mailutils"
;;
almalinux|rocky|centos|rhel|ol|fedora)
PKG_MGR="dnf"
PKG_UPDATE="dnf update -y"
PKG_INSTALL="dnf install -y"
FIREWALL_CMD="firewalld"
MAIL_PACKAGE="mailx"
;;
amzn)
PKG_MGR="yum"
PKG_UPDATE="yum update -y"
PKG_INSTALL="yum install -y"
FIREWALL_CMD="firewalld"
MAIL_PACKAGE="mailx"
;;
*)
echo -e "${RED}Unsupported distribution: $ID${NC}"
exit 1
;;
esac
echo -e "${GREEN}Detected: $PRETTY_NAME${NC}"
else
echo -e "${RED}Cannot detect distribution${NC}"
exit 1
fi
# Update system packages
echo -e "${BLUE}[2/10] Updating system packages...${NC}"
$PKG_UPDATE
# Install required dependencies
echo -e "${BLUE}[3/10] Installing dependencies...${NC}"
if [[ "$PKG_MGR" == "apt" ]]; then
$PKG_INSTALL curl wget git build-essential autoconf automake pkg-config \
zlib1g-dev libssl-dev libuv1-dev cmake libjson-c-dev libelf-dev liblz4-dev
else
$PKG_INSTALL curl wget git gcc gcc-c++ make autoconf automake pkgconfig \
zlib-devel openssl-devel libuv-devel cmake json-c-devel elfutils-libelf-devel lz4-devel
fi
# Download and install Netdata
echo -e "${BLUE}[4/10] Installing Netdata...${NC}"
curl -Ss https://get.netdata.cloud/kickstart.sh | bash -s -- --stable-channel --disable-telemetry
# Enable and start Netdata service
echo -e "${BLUE}[5/10] Configuring Netdata service...${NC}"
systemctl enable netdata
systemctl start netdata
sleep 3
# Verify service is running
if ! systemctl is-active --quiet netdata; then
echo -e "${RED}Netdata service failed to start${NC}"
exit 1
fi
# Configure firewall
echo -e "${BLUE}[6/10] Configuring firewall...${NC}"
if [[ "$FIREWALL_CMD" == "ufw" ]]; then
if command -v ufw >/dev/null 2>&1; then
ufw allow 19999/tcp
ufw --force enable || true
fi
else
if systemctl is-active --quiet firewalld; then
firewall-cmd --permanent --add-port=19999/tcp
firewall-cmd --reload
fi
fi
# Create Netdata configuration directory if it doesn't exist
echo -e "${BLUE}[7/10] Configuring Netdata...${NC}"
mkdir -p /etc/netdata
chown netdata:netdata /etc/netdata
chmod 755 /etc/netdata
# Configure Netdata web settings
/usr/libexec/netdata/edit-config netdata.conf <<EOF
[web]
bind to = *
allow connections from = localhost 127.0.0.1 ::1${NETWORK_RANGE:+ }${NETWORK_RANGE}
allow management from = localhost 127.0.0.1
enable gzip compression = yes
web files owner = netdata
web files group = netdata
[global]
update every = 1
memory mode = dbengine
page cache size = 32
dbengine disk space = 256
EOF
# Set up basic authentication if available
if command -v htpasswd >/dev/null 2>&1; then
echo -e "${YELLOW}Setting up web authentication...${NC}"
echo -e "${BLUE}Please enter password for 'admin' user:${NC}"
htpasswd -c /etc/netdata/netdata.htpasswd admin
chown netdata:netdata /etc/netdata/netdata.htpasswd
chmod 644 /etc/netdata/netdata.htpasswd
else
echo -e "${YELLOW}htpasswd not available, skipping web authentication setup${NC}"
fi
# Install email notification dependencies if email is provided
if [[ -n "$ADMIN_EMAIL" ]]; then
echo -e "${BLUE}[8/10] Setting up email notifications...${NC}"
$PKG_INSTALL $MAIL_PACKAGE
# Configure health alert notifications
/usr/libexec/netdata/edit-config health_alarm_notify.conf <<EOF
# Email configuration
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="$ADMIN_EMAIL"
EMAIL_SENDER="netdata@$(hostname -f)"
# Email command
SENDMAIL="/usr/bin/mail"
# Enable notifications for specific roles
role_recipients_email[sysadmin]="$ADMIN_EMAIL"
EOF
chown netdata:netdata /etc/netdata/health_alarm_notify.conf
chmod 644 /etc/netdata/health_alarm_notify.conf
else
echo -e "${BLUE}[8/10] Skipping email notifications (no email provided)...${NC}"
fi
# Restart Netdata to apply configuration
echo -e "${BLUE}[9/10] Restarting Netdata service...${NC}"
systemctl restart netdata
sleep 5
# Verify installation
echo -e "${BLUE}[10/10] Verifying installation...${NC}"
# Check if service is running
if ! systemctl is-active --quiet netdata; then
echo -e "${RED}Netdata service is not running${NC}"
exit 1
fi
# Check if port 19999 is listening
if ! netstat -tuln 2>/dev/null | grep -q :19999 && ! ss -tuln 2>/dev/null | grep -q :19999; then
echo -e "${RED}Netdata is not listening on port 19999${NC}"
exit 1
fi
# Test web interface
if curl -s -o /dev/null -w "%{http_code}" http://localhost:19999 | grep -q "200"; then
echo -e "${GREEN}Netdata web interface is accessible${NC}"
else
echo -e "${YELLOW}Netdata web interface test failed, but service is running${NC}"
fi
echo -e "${GREEN}✓ Netdata installation completed successfully!${NC}"
echo -e "${GREEN}✓ Web dashboard available at: http://$(hostname -I | awk '{print $1}'):19999${NC}"
echo -e "${GREEN}✓ Service status: $(systemctl is-active netdata)${NC}"
if [[ -n "$ADMIN_EMAIL" ]]; then
echo -e "${GREEN}✓ Email alerts configured for: $ADMIN_EMAIL${NC}"
fi
if [[ -n "$NETWORK_RANGE" ]]; then
echo -e "${GREEN}✓ Web access configured for network: $NETWORK_RANGE${NC}"
fi
echo -e "${BLUE}Additional configuration files located in: /etc/netdata/${NC}"
echo -e "${BLUE}Service logs: journalctl -u netdata -f${NC}"
# Disable trap on successful completion
trap - ERR
Review the script before running. Execute with: bash install.sh