Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
proxmox [2025/06/14 20:32] jango [Traffic Monitoring] |
proxmox [2025/07/04 11:26] (aktuell) jango [Links] |
||
---|---|---|---|
Zeile 211: | Zeile 211: | ||
{{https:// | {{https:// | ||
- | =====Traffic Monitoring===== | + | =====API===== |
- | Um den Traffic einzelner VMs/Container verlässlich zu monitoren braucht man zusätzliche Tools. | + | <code bash> |
+ | #!/bin/bash | ||
- | < | + | # ===== KONFIGURATION ===== |
- | apt update && apt install vnstat | + | PVE_HOST=" |
- | </ | + | PVE_USER=" |
+ | PVE_PASS=" | ||
+ | PVE_NODE=" | ||
- | Finde das Netzwerkinterface deiner VM (z. B. tap102i0): | + | VMID=120 |
+ | HOSTNAME=" | ||
+ | TEMPLATE=" | ||
+ | MEMORY=512 | ||
+ | CORES=1 | ||
+ | DISK_SIZE=1 | ||
+ | BRIDGE=" | ||
+ | IP_CONFIG=" | ||
+ | ROOT_PASS=" | ||
- | <code bash> | + | # ===== LOGIN (Ticket holen) ===== |
- | qm list | + | echo "[*] Authentifiziere bei Proxmox API..." |
- | qm config 102 | + | AUTH_RESPONSE=$(curl -sk -d " |
- | </code> | + | |
- | < | + | TICKET=$(echo " |
- | ip link | grep tap | + | CSRF=$(echo " |
- | </ | + | |
- | < | + | if [[ -z " |
- | vnstat | + | echo "[!] Fehler: Authentifizierung fehlgeschlagen." |
- | </ | + | exit 1 |
+ | fi | ||
- | Zeige Statistik seit Mitternacht oder stündlich: | + | # ===== LXC erstellen ===== |
+ | echo "[*] Erstelle LXC-Container $VMID auf Node $PVE_NODE..." | ||
- | <code bash> | + | CREATE_RESPONSE=$(curl -sk -X POST https:// |
- | vnstat | + | -H " |
- | vnstat | + | |
- | vnstat | + | -d vmid=$VMID \ |
- | </ | + | |
+ | -d ostemplate=$TEMPLATE \ | ||
+ | | ||
+ | -d cores=$CORES \ | ||
+ | -d rootfs=" | ||
+ | -d unprivileged=1) | ||
- | <code bash> | + | echo "$CREATE_RESPONSE" |
- | $ vnstat -i tap102i0 -h | + | |
- | | + | # ===== Container starten ===== |
+ | echo "[*] Starte Container $VMID..." | ||
+ | answer=$(curl -sk -X POST https:// | ||
+ | -H " | ||
+ | -b " | ||
- | hour rx | | + | sleep 15 |
- | ------------------------+-------------+------------ | + | |
- | 19:00-20:00 73 MB | 3 MB | 76 MB | + | ssh root@192.168.0.100 "pct exec $VMID -- bash -c ' |
- | 20:00-21:00 103 MB | + | ssh root@192.168.0.100 "pct exec $VMID -- bash -c 'echo user:$ROOT_PASS |
+ | ssh root@192.168.0.100 "pct set $VMID -net0 name=eth0, | ||
+ | |||
+ | echo "[✓] Container $VMID wurde erstellt und gestartet." | ||
</ | </ | ||
+ | |||
+ | =====Traffic Monitoring===== | ||
+ | |||
+ | Um den Traffic einzelner VMs/ | ||
=====Links===== | =====Links===== | ||
Zeile 258: | Zeile 284: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// |