Initial Proxmox dashboard with host and guest metrics

This commit is contained in:
maxim
2026-07-31 19:51:22 +03:00
commit 584ff7e8ee
21 changed files with 1780 additions and 0 deletions

17
guests_test.go Normal file
View File

@@ -0,0 +1,17 @@
package main
import (
"encoding/json"
"testing"
)
func TestGuestJSON(t *testing.T) {
data := []byte(`{"vmid":101,"name":"test","type":"qemu","status":"running","cpu":0.25,"maxcpu":4,"mem":1024,"maxmem":4096,"uptime":60}`)
var guest GuestMetrics
if err := json.Unmarshal(data, &guest); err != nil {
t.Fatal(err)
}
if guest.VMID != 101 || guest.CPU != 0.25 || guest.MaxCPU != 4 {
t.Fatalf("неожиданные данные гостя: %+v", guest)
}
}