Netdata sur Rocky Linux 9
Installation de Netdata - monitoring temps réel avec dashboard.
| Composant | Version |
|---|---|
| Rocky Linux | 9.x |
| Netdata | Latest |
Durée estimée : 10 minutes
Fonctionnalités
| Fonction | Description |
|---|---|
| Real-time | Métriques par seconde |
| Auto-discovery | Détection auto services |
| Zero config | Fonctionne immédiatement |
| Low footprint | Léger en ressources |
| Alerting | Alertes intégrées |
1. Installation
Script officiel
wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh
bash /tmp/netdata-kickstart.sh --stable-channel --disable-telemetry
Via repository
cat > /etc/yum.repos.d/netdata.repo << 'EOF'
[netdata_stable]
name=Netdata Stable
baseurl=https://packagecloud.io/netdata/netdata-stable/el/9/$basearch
gpgcheck=1
gpgkey=https://packagecloud.io/netdata/netdata-stable/gpgkey
enabled=1
EOF
dnf install -y netdata
systemctl enable --now netdata
2. Firewall
3. Accès
- URL:
http://IP:19999 - Pas d'authentification par défaut
4. Configuration
Fichier principal
[global]
hostname = server1
history = 3996 # 1 heure à 1 seconde
update every = 1
[web]
bind to = 0.0.0.0
default port = 19999
[plugins]
proc = yes
diskspace = yes
cgroups = yes
Appliquer
5. Authentification basique
Avec Nginx
dnf install -y nginx httpd-tools
htpasswd -c /etc/nginx/.htpasswd admin
cat > /etc/nginx/conf.d/netdata.conf << 'EOF'
server {
listen 80;
server_name netdata.example.com;
location / {
proxy_pass http://127.0.0.1:19999;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
auth_basic "Netdata";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
EOF
systemctl enable --now nginx
6. Collectors / Plugins
Plugins actifs
Configurer un collector
Activer le stub_status Nginx
7. Monitoring Docker
Activer le plugin cgroups
Socket Docker
8. Monitoring MySQL/MariaDB
Créer l'utilisateur MySQL :
CREATE USER 'netdata'@'localhost' IDENTIFIED BY 'netdata';
GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost';
FLUSH PRIVILEGES;
9. Alerting
Configuration alertes
alarm: cpu_usage
on: system.cpu
lookup: average -1m percentage of user,system
every: 10s
warn: $this > 80
crit: $this > 95
info: CPU usage is high
Notifications
# Email
SEND_EMAIL="YES"
DEFAULT_RECIPIENT_EMAIL="admin@example.com"
# Slack
SEND_SLACK="YES"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/XXX"
DEFAULT_RECIPIENT_SLACK="#alerts"
# Discord
SEND_DISCORD="YES"
DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/XXX"
Tester
10. Streaming (Parent/Child)
Sur le parent
Sur le child
11. Netdata Cloud
Connecter à Netdata Cloud
12. Retention des données
Modifier la retention
13. Export vers Prometheus
[prometheus:remote_write]
enabled = yes
destination = localhost:9090
remote write URL path = /api/v1/write
Commandes utiles
# Status
systemctl status netdata
# Logs
journalctl -u netdata -f
cat /var/log/netdata/error.log
# Vérifier config
netdata -W conf
# Redémarrer
systemctl restart netdata
# Info
netdatacli info
Dépannage
# Vérifier les collectors
curl -s localhost:19999/api/v1/info | jq .collectors
# Debug
netdata -D # Foreground avec debug
# Plugins health
/usr/libexec/netdata/plugins.d/python.d.plugin debug 1
# Permissions
ls -la /var/run/docker.sock
Changelog
| Date | Modification |
|---|---|
| 2024-12 | Création initiale |