Skip to main content

Monitoring – Uptime Kuma & Grafana (Dashboards, Alerts)

Zwei sich ergänzende Werkzeuge: Uptime Kuma als simpler Uptime-Watcher mit Alerts, Grafana mit Prometheus/Node-Exporter für tiefe Metriken (GPU, Container, System).


1. Zielsetzung

    Wissen, ob ein Service down ist – bevor der Anwender anruft Trends erkennen (VRAM-Auslastung, CPU-Last, Festplattenfüllgrad) Audit-Nachweis: kontinuierlicher Betrieb mit Logs & Screenshots Alarmierung über mehrere Kanäle (Telegram, E-Mail, Discord)

    2. Architektur

    ┌──────────────┐       ┌──────────────────────┐
    │ Uptime Kuma  │       │ Grafana + Prometheus │
    │              │       │                      │
    │ Status-Pings │       │ ┌─Node Exporter─┐    │
    │ HTTP, TCP,   │       │ │  System-Stats │    │
    │ DNS, Docker  │       │ └───────────────┘    │
    │              │       │ ┌─cAdvisor──────┐    │
    │ Alerts:      │       │ │  Container    │    │
    │ Telegram     │       │ └───────────────┘    │
    │ E-Mail       │       │ ┌─nvidia_exporter┐   │
    │ Discord      │       │ │  GPU-Metriken  │   │
    └──────────────┘       │ └────────────────┘   │
                           └──────────────────────┘

    3. Uptime Kuma

    3.1 Installation

    mkdir -p ~/0_docker/3001_uptime-kuma/data
    cd ~/0_docker/3001_uptime-kuma
    
    cat > docker-compose.yml << 'EOF'
    services:
      uptime-kuma:
        image: louislam/uptime-kuma:latest
        container_name: uptime-kuma
        restart: unless-stopped
        ports:
          - "192.168.0.16:3001:3001"
        volumes:
          - ./data:/app/data
          - /var/run/docker.sock:/var/run/docker.sock:ro
    EOF
    
    docker compose up -d

    3.2 Erstes Setup

      Browser: http://192.168.0.16:3001 Admin-Account anlegen, Passwort in Vaultwarden hinterlegen Reverse Proxy: monitor.kistudent.local → 192.168.0.16:3001 (WebSocket nötig!)

      3.3 Monitor-Vorlagen

      Monitor-Typ Beispiel Intervall HTTP(s) https://crm.kistudent.local 60 s HTTP(s) – Keyword BookStack erwartet "Login" 120 s TCP Port 192.168.0.16:8000 (Ollama) 60 s Docker Container crm_backend, crm_mariadb, ollama 60 s DNS crm.kistudent.local via Pi-hole 300 s Ping Synology 192.168.0.82 60 s Push (Backup-Heartbeat) aus backup.sh per curl 1× pro Tag

      3.4 Notifications

        Settings → Notifications → Setup Notification Telegram (empfohlen):
          BotFather: /newbot, Token notieren Bot anschreiben, dann https://api.telegram.org/bot<TOKEN>/getUpdates aufrufen, Chat-ID notieren In Uptime Kuma Token + Chat-ID hinterlegen E-Mail (SMTP): Über Exista-SMTP oder externen Anbieter (Sendgrid) Pro Monitor mindestens 2 Notification-Channels auswählen

          3.5 Public Status Page (optional)

          Unter Status Pages → Add kann eine öffentlich einsehbare Statusseite erzeugt werden – nützlich für Audit-Demo: einfach den Link zeigen, und der Coach sieht den 7-Tage-Uptime-Verlauf.

          4. Grafana + Prometheus

          4.1 Stack-Compose

          mkdir -p ~/0_docker/3030_monitoring/{prometheus,grafana,alertmanager}
          cd ~/0_docker/3030_monitoring

          docker-compose.yml:

          services:
            prometheus:
              image: prom/prometheus:latest
              container_name: prometheus
              restart: unless-stopped
              ports:
                - "192.168.0.16:9090:9090"
              volumes:
                - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
                - prometheus_data:/prometheus
              command:
                - '--config.file=/etc/prometheus/prometheus.yml'
                - '--storage.tsdb.retention.time=90d'
          
            node-exporter:
              image: prom/node-exporter:latest
              container_name: node-exporter
              restart: unless-stopped
              network_mode: host
              pid: host
              command:
                - '--path.rootfs=/host'
              volumes:
                - '/:/host:ro,rslave'
          
            cadvisor:
              image: gcr.io/cadvisor/cadvisor:latest
              container_name: cadvisor
              restart: unless-stopped
              ports:
                - "192.168.0.16:8081:8080"
              volumes:
                - /:/rootfs:ro
                - /var/run:/var/run:ro
                - /sys:/sys:ro
                - /var/lib/docker/:/var/lib/docker:ro
                - /dev/disk/:/dev/disk:ro
          
            nvidia-exporter:
              image: utkuozdemir/nvidia_gpu_exporter:latest
              container_name: nvidia-exporter
              restart: unless-stopped
              ports:
                - "192.168.0.16:9835:9835"
              volumes:
                - /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1:/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1:ro
                - /usr/bin/nvidia-smi:/usr/bin/nvidia-smi:ro
              runtime: nvidia
              environment:
                - NVIDIA_VISIBLE_DEVICES=all
                - NVIDIA_DRIVER_CAPABILITIES=all
          
            grafana:
              image: grafana/grafana:latest
              container_name: grafana
              restart: unless-stopped
              ports:
                - "192.168.0.16:3030:3000"
              volumes:
                - grafana_data:/var/lib/grafana
                - ./grafana/provisioning:/etc/grafana/provisioning
              environment:
                GF_SECURITY_ADMIN_PASSWORD: 'HIER_STARK'
                GF_USERS_ALLOW_SIGN_UP: 'false'
          
          volumes:
            prometheus_data:
            grafana_data:

          4.2 prometheus.yml

          global:
            scrape_interval: 30s
            evaluation_interval: 30s
          
          scrape_configs:
            - job_name: 'node'
              static_configs:
                - targets: ['192.168.0.16:9100']
          
            - job_name: 'cadvisor'
              static_configs:
                - targets: ['192.168.0.16:8081']
          
            - job_name: 'nvidia'
              static_configs:
                - targets: ['192.168.0.16:9835']

          4.3 Grafana – erste Schritte

            Browser: http://192.168.0.16:3030 – Admin-Login Data Sources → Add → Prometheus: URL http://192.168.0.16:9090 Dashboards → Import, folgende IDs:
              1860 – Node Exporter Full 14282 – cAdvisor Exporter 14574 – NVIDIA GPU Exporter Jeweils die Prometheus-Data-Source zuweisen, importieren

              4.4 Wichtige Metriken im Auge behalten

              Metrik Warnung Kritisch Disk Usage / >80 % >90 % RAM Usage >80 % >95 % GPU Temperature >75 °C dauerhaft >83 °C GPU VRAM Usage >28 GB dauerhaft OOM-Risiko Container Restarts >3 / Stunde >10 / Stunde SSH Login Failures >10 / Minute (Fail2ban greift)

              5. Grafana-Alerts

              In jedem Panel können Alerts gesetzt werden:

              Edit Panel → Alert → Create Alert
              - Evaluate every: 1m for 5m
              - Conditions: WHEN avg() OF query(A, 5m, now) IS ABOVE 90
              - Notifications: Telegram-Channel

              Notifications-Konfiguration unter Alerting → Contact points.

              6. Disk-Space-Alerts: konkretes Beispiel

              # PromQL
              (node_filesystem_size_bytes{mountpoint="/"} - node_filesystem_free_bytes{mountpoint="/"})
               / node_filesystem_size_bytes{mountpoint="/"} * 100

              Threshold 80 % → Warning, 90 % → Critical, mit Telegram-Notification.

              7. Reverse Proxy

              Subdomain Service Port WebSocket monitor.kistudent.local Uptime Kuma 3001 Ja grafana.kistudent.local Grafana 3030 Nein prometheus.kistudent.local Prometheus (intern!) 9090 Nein

              Prometheus & Exporter sollten nur intern erreichbar sein – nicht via öffentliche Subdomain. Grafana ist der einzige öffentliche Zugriffspunkt.

              8. Wartung & Troubleshooting

              Symptom Ursache Lösung Prometheus läuft, aber keine Daten Targets unreachable http://192.168.0.16:9090/targets prüfen NVIDIA-Exporter wirft Fehler libnvidia-ml-Pfad falsch Pfad im Volume-Mount anpassen (Distro-abhängig) Uptime Kuma sendet keine Telegram-Alerts Bot-Token oder Chat-ID falsch Mit curl https://api.telegram.org/bot<TOKEN>/getMe testen Disk-Alerts triggern ständig Threshold zu niedrig Threshold + for: 15m setzen Push-Monitor (Backup) löst Alarm aus Backup-Cron ausgefallen Cron-Logs prüfen, Backup manuell triggern

              9. Backup & Wartung

                Grafana & Prometheus Volumes ins Backup-Set (siehe Backup-Seite) Dashboards exportierbar als JSON (Settings → Export → Save to file) Prometheus-Retention 90 Tage (in compose storage.tsdb.retention.time=90d)

                10. Checkliste

                  ☐ Uptime Kuma läuft, alle wichtigen Services überwacht ☐ Push-Heartbeat für Backups eingerichtet ☐ Mindestens 2 Notification-Channels (Telegram + E-Mail) ☐ Grafana + Prometheus + Exporter laufen ☐ Mindestens 3 Dashboards importiert & konfiguriert ☐ Disk/RAM/GPU-Alerts mit Schwellwerten gesetzt ☐ Reverse Proxy & HTTPS für Uptime Kuma + Grafana ☐ Public Status Page für Audit-Demo verfügbar ☐ Monitoring-Volumes im Backup-Set

                  Querverweise: Backup-Lösung | nächste Seite: Betriebsnachweis – 7-Tage-Monitoring