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 IntegrationenInstallation
Einzeiler (empfohlen)
bash <(curl -Ss https://get.netdata.cloud/kickstart.sh)Debian/Ubuntu
apt update
apt install netdataCentOS/RHEL
dnf install epel-release
dnf install netdataDocker
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/netdataService aktivieren
systemctl enable --now netdataWeb-Interface
Zugriff
URL: http://server-ip:19999Dashboard-Ü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 = 256Memory 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 highBenachrichtigungen
# /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_logKollektoren (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 netdataAPI
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 = noneNetdata Cloud
Registrierung
# Mit Netdata Cloud verbinden
netdata-claim.sh -token=YOUR_TOKEN -rooms=YOUR_ROOMVorteile
- Zentrales Dashboard
- Multi-Server-Ansicht
- Keine Portfreigabe nötig
- Kostenlose Basis-FunktionenSicherheit
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 19999Performance
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 = noNur bestimmte Charts
# /etc/netdata/netdata.conf
[system.cpu]
enabled = yes
[system.load]
enabled = yes
# Rest deaktivieren
[*]
enabled = noTroubleshooting
Service-Status
systemctl status netdata
journalctl -u netdata -fDebug-Modus
# Debug-Log aktivieren
# /etc/netdata/netdata.conf
[global]
debug log = /var/log/netdata/debug.log
# Oder manuell starten
netdata -DKollektor-Debug
# Plugin manuell testen
/usr/libexec/netdata/plugins.d/go.d.plugin -d -m nginxZusammenfassung
| 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.