Status : IMPLEMENTEE
# ===========================================
# COLLECTE WIN11 (192.168.1.30)
# ===========================================
echo "[$(date)] Collecte win11..."
WIN11_PING=$(ping -c 1 -W 2 192.168.1.30 >/dev/null 2>&1 && echo "ok" || echo "error")
# Test SSH (Windows peut bloquer ping mais accepter SSH)
WIN11_SSH=$(timeout 5 ssh -o ConnectTimeout=3 -o BatchMode=yes gouro@win11.local "echo ok" 2>/dev/null || echo "error")
if [ "$WIN11_SSH" = "ok" ]; then
WIN11_HOSTNAME=$(ssh gouro@win11.local "hostname" 2>/dev/null | tr -d '\r\n')
WIN11_CPU=$(ssh gouro@win11.local "wmic cpu get loadpercentage /value" 2>/dev/null | grep -o '[0-9]*' | head -1)
[ -z "$WIN11_CPU" ] && WIN11_CPU="0"
WIN11_RAM_INFO=$(ssh gouro@win11.local "wmic OS get FreePhysicalMemory,TotalVisibleMemorySize /value" 2>/dev/null)
WIN11_RAM_FREE=$(echo "$WIN11_RAM_INFO" | grep FreePhysicalMemory | grep -o '[0-9]*')
WIN11_RAM_TOTAL=$(echo "$WIN11_RAM_INFO" | grep TotalVisibleMemorySize | grep -o '[0-9]*')
if [ -n "$WIN11_RAM_FREE" ] && [ -n "$WIN11_RAM_TOTAL" ]; then
WIN11_RAM_USED=$((WIN11_RAM_TOTAL - WIN11_RAM_FREE))
WIN11_RAM=$((WIN11_RAM_USED * 100 / WIN11_RAM_TOTAL))
WIN11_RAM_USED_GB=$(echo "scale=1; $WIN11_RAM_USED / 1048576" | bc)
WIN11_RAM_TOTAL_GB=$(echo "scale=1; $WIN11_RAM_TOTAL / 1048576" | bc)
else
WIN11_RAM="0"; WIN11_RAM_USED_GB="0"; WIN11_RAM_TOTAL_GB="0"
fi
# Disques (C: système)
WIN11_DISK_C=$(ssh gouro@win11.local "wmic logicaldisk where \"DeviceID='C:'\" get Size,FreeSpace /value" 2>/dev/null)
WIN11_DISK_FREE=$(echo "$WIN11_DISK_C" | grep FreeSpace | grep -o '[0-9]*')
WIN11_DISK_SIZE=$(echo "$WIN11_DISK_C" | grep Size | grep -o '[0-9]*')
if [ -n "$WIN11_DISK_FREE" ] && [ -n "$WIN11_DISK_SIZE" ]; then
WIN11_DISK_USED=$((WIN11_DISK_SIZE - WIN11_DISK_FREE))
WIN11_DISK=$((WIN11_DISK_USED * 100 / WIN11_DISK_SIZE))
else
WIN11_DISK="0"
fi
# Service SSH
WIN11_SSH_SERVICE=$(ssh gouro@win11.local "powershell -Command \"(Get-Service sshd).Status\"" 2>/dev/null | tr -d '\r\n')
WIN11_STATUS="ok"
[ "$WIN11_RAM" -ge 90 ] 2>/dev/null && WIN11_STATUS="warning"
[ "$WIN11_DISK" -ge 85 ] 2>/dev/null && WIN11_STATUS="warning"
else
WIN11_STATUS="error"
WIN11_HOSTNAME="win11"; WIN11_CPU="0"; WIN11_RAM="0"; WIN11_RAM_USED_GB="0"; WIN11_RAM_TOTAL_GB="0"
WIN11_DISK="0"; WIN11_SSH_SERVICE="unknown"
fi
Après la collecte du pool stock_36to, ajouter :
# Pool ZFS win_hdd (RAIDZ1 pour VM Windows)
PVE_ZFS_WIN_STATE=$(ssh_cmd pve.local "sudo zpool status win_hdd 2>/dev/null | grep 'state:' | awk '{print \$2}'" | tr -d '\n')
[ -z "$PVE_ZFS_WIN_STATE" ] && PVE_ZFS_WIN_STATE="UNKNOWN"
PVE_ZFS_WIN_INFO=$(ssh_cmd pve.local "zfs list win_hdd -H -o used,avail 2>/dev/null")
PVE_ZFS_WIN_USED=$(echo "$PVE_ZFS_WIN_INFO" | awk '{print $1}')
PVE_ZFS_WIN_AVAIL=$(echo "$PVE_ZFS_WIN_INFO" | awk '{print $2}')
Dans la section génération JSON :
"win11": {
"ip": "192.168.1.30",
"status": "$WIN11_STATUS",
"ping": "$WIN11_PING",
"ssh": "$WIN11_SSH",
"hostname": "$WIN11_HOSTNAME",
"system": {
"cpu": $WIN11_CPU,
"ram": $WIN11_RAM,
"ram_used": "${WIN11_RAM_USED_GB}G",
"ram_total": "${WIN11_RAM_TOTAL_GB}G",
"disk": $WIN11_DISK
},
"services": {
"ssh": "$WIN11_SSH_SERVICE",
"ollama": "$OLLAMA_STATUS"
}
}
Ajouter une carte Windows dans le dashboard avec :
| Fichier | Action |
|---|---|
| collect.sh | Ajouter section WIN11, pool ZFS win_hdd |
| generate.sh | Ajouter carte win11 |
| README.md | Documentation |
# Tester collecte manuellement
/mnt/stock_36to/data/33800-stack/monitoring/collect.sh
# Vérifier JSON
jq . /mnt/stock_36to/data/33800-stack/monitoring/current.json | grep -A20 win11
# Vérifier dashboard
curl -s https://dashboard.33800.nowhere84.com | grep -i win11
Attente validation avant exécution