Netdata ist ein leistungsstarkes Echtzeit-Monitoring-Tool mit integriertem Web-Dashboard. Es sammelt tausende Metriken pro Sekunde bei minimalem Ressourcenverbrauch.

Warum Netdata?

Vorteile

- Echtzeit-Metriken (1-Sekunden-Granularität)
- Schönes Web-Dashboard
- Automatische Erkennung von Services
- Geringer Ressourcenverbrauch
- Keine Konfiguration nötig
- Kostenlos (Open Source)

Was wird überwacht?

- CPU, RAM, Disk, Netzwerk
- Docker Container
- Datenbanken (MySQL, PostgreSQL, MongoDB)
- Webserver (Nginx, Apache)
- Systemd Services
- Logs
- und über 200 weitere Integrationen

Installation

Einzeiler (empfohlen)

bash <(curl -Ss https://get.netdata.cloud/kickstart.sh)

Debian/Ubuntu

apt update
apt install netdata

CentOS/RHEL

dnf install epel-release
dnf install netdata

Docker

docker run -d --name=netdata \
  -p 19999:19999 \
  -v netdataconfig:/etc/netdata \
  -v netdatalib:/var/lib/netdata \
  -v netdatacache:/var/cache/netdata \
  -v /etc/passwd:/host/etc/passwd:ro \
  -v /etc/group:/host/etc/group:ro \
  -v /proc:/host/proc:ro \
  -v /sys:/host/sys:ro \
  -v /etc/os-release:/host/etc/os-release:ro \
  --cap-add SYS_PTRACE \
  --security-opt apparmor=unconfined \
  netdata/netdata

Service aktivieren

systemctl enable --now netdata

Web-Interface

Zugriff

URL: http://server-ip:19999

Dashboard-Übersicht

- System Overview: CPU, RAM, Disk
- Network: Bandbreite, Pakete, Fehler
- Disks: I/O, Latenz
- Applications: Per-Prozess-Metriken
- Containers: Docker-Metriken
- Databases: MySQL, PostgreSQL, etc.

Konfiguration

Hauptkonfiguration

# /etc/netdata/netdata.conf

[global]
    run as user = netdata
    history = 3996
    memory mode = dbengine

[web]
    bind to = 0.0.0.0
    default port = 19999

[db]
    update every = 1
    memory mode = dbengine
    page cache size = 32
    dbengine multihost disk space = 256

Memory Mode

| Mode | Beschreibung | RAM | |------|--------------|-----| | ram | Nur RAM | Hoch | | dbengine | Disk + RAM Cache | Mittel | | none | Keine Historie | Minimal |

Zugriff beschränken

# /etc/netdata/netdata.conf

[web]
    bind to = 127.0.0.1
    allow connections from = localhost 192.168.1.* 10.0.0.*

Alarme

Alarm-Konfiguration

# /etc/netdata/health.d/cpu.conf

alarm: cpu_usage_high
    on: system.cpu
    lookup: average -1m unaligned of user,system,softirq,irq
    units: %
    every: 10s
    warn: $this > 80
    crit: $this > 95
    info: CPU usage is too high

Benachrichtigungen

# /etc/netdata/health_alarm_notify.conf

# E-Mail
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="admin@example.com"

# Slack
SEND_SLACK="YES"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
DEFAULT_RECIPIENT_SLACK="#alerts"

# Telegram
SEND_TELEGRAM="YES"
TELEGRAM_BOT_TOKEN="..."
DEFAULT_RECIPIENT_TELEGRAM="..."

Alarm-Status

# Aktive Alarme
curl -s http://localhost:19999/api/v1/alarms | jq

# Alarm-Log
curl -s http://localhost:19999/api/v1/alarm_log

Kollektoren (Plugins)

Aktive Kollektoren

# Liste aller Kollektoren
ls /usr/libexec/netdata/plugins.d/
ls /etc/netdata/go.d/

MySQL-Monitoring

# /etc/netdata/go.d/mysql.conf

jobs:
  - name: local
    dsn: netdata@tcp(localhost:3306)/
-- MySQL-Benutzer erstellen
CREATE USER 'netdata'@'localhost';
GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost';
FLUSH PRIVILEGES;

PostgreSQL-Monitoring

# /etc/netdata/go.d/postgres.conf

jobs:
  - name: local
    dsn: 'host=localhost port=5432 user=netdata dbname=postgres'

Nginx-Monitoring

# /etc/netdata/go.d/nginx.conf

jobs:
  - name: local
    url: http://127.0.0.1/nginx_status
# Nginx stub_status aktivieren
server {
    listen 80;
    location /nginx_status {
        stub_status;
        allow 127.0.0.1;
        deny all;
    }
}

Docker-Monitoring

# Netdata zur Docker-Gruppe hinzufügen
usermod -aG docker netdata
systemctl restart netdata

API

Daten abfragen

# System-Info
curl -s http://localhost:19999/api/v1/info

# Charts-Liste
curl -s http://localhost:19999/api/v1/charts

# CPU-Daten
curl -s "http://localhost:19999/api/v1/data?chart=system.cpu&after=-60"

# Mit Format
curl -s "http://localhost:19999/api/v1/data?chart=system.cpu&format=csv"

Alarme via API

# Alle Alarme
curl -s http://localhost:19999/api/v1/alarms

# Alarm-Log
curl -s "http://localhost:19999/api/v1/alarm_log?after=-3600"

Streaming (Multi-Server)

Parent (Zentral)

# /etc/netdata/stream.conf

[stream]
    enabled = yes

[API_KEY]
    enabled = yes
    default memory mode = dbengine
    health enabled by default = auto
    allow from = 192.168.1.*

Child (Remote-Server)

# /etc/netdata/stream.conf

[stream]
    enabled = yes
    destination = parent-server:19999
    api key = API_KEY

# Lokale Speicherung deaktivieren
# /etc/netdata/netdata.conf
[db]
    memory mode = none

Netdata Cloud

Registrierung

# Mit Netdata Cloud verbinden
netdata-claim.sh -token=YOUR_TOKEN -rooms=YOUR_ROOM

Vorteile

- Zentrales Dashboard
- Multi-Server-Ansicht
- Keine Portfreigabe nötig
- Kostenlose Basis-Funktionen

Sicherheit

Nginx Reverse Proxy

# /etc/nginx/sites-available/netdata

upstream netdata {
    server 127.0.0.1:19999;
}

server {
    listen 443 ssl http2;
    server_name netdata.example.com;

    ssl_certificate /etc/letsencrypt/live/netdata.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/netdata.example.com/privkey.pem;

    auth_basic "Netdata";
    auth_basic_user_file /etc/nginx/.htpasswd;

    location / {
        proxy_pass http://netdata;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Firewall

# Nur lokal
ufw deny 19999

# Oder nur von bestimmten IPs
ufw allow from 192.168.1.0/24 to any port 19999

Performance

Ressourcenverbrauch reduzieren

# /etc/netdata/netdata.conf

[global]
    update every = 2  # Statt 1 Sekunde

[db]
    memory mode = save

[plugins]
    # Unbenötigte Plugins deaktivieren
    cgroups = no
    apps = no

Nur bestimmte Charts

# /etc/netdata/netdata.conf

[system.cpu]
    enabled = yes

[system.load]
    enabled = yes

# Rest deaktivieren
[*]
    enabled = no

Troubleshooting

Service-Status

systemctl status netdata
journalctl -u netdata -f

Debug-Modus

# Debug-Log aktivieren
# /etc/netdata/netdata.conf
[global]
    debug log = /var/log/netdata/debug.log

# Oder manuell starten
netdata -D

Kollektor-Debug

# Plugin manuell testen
/usr/libexec/netdata/plugins.d/go.d.plugin -d -m nginx

Zusammenfassung

| URL | Funktion | |-----|----------| | /api/v1/info | System-Info | | /api/v1/charts | Verfügbare Charts | | /api/v1/data?chart=NAME | Chart-Daten | | /api/v1/alarms | Aktive Alarme |

| Datei | Beschreibung | |-------|--------------| | /etc/netdata/netdata.conf | Hauptkonfiguration | | /etc/netdata/health.d/ | Alarm-Definitionen | | /etc/netdata/go.d/ | Plugin-Konfiguration | | /etc/netdata/stream.conf | Streaming-Konfiguration |

Fazit

Netdata bietet beeindruckendes Echtzeit-Monitoring mit minimalem Setup-Aufwand. Die automatische Erkennung von Services und das schöne Dashboard machen es ideal für schnelle Einblicke. Für größere Umgebungen empfiehlt sich Netdata Cloud oder ein Streaming-Setup. Kombinieren Sie Netdata mit einem Alerting-System für proaktive Überwachung.