Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
chore(deps): qualify the native metrics dependency update
pulse-triage[bot]a61f1c7c82ad
diff --git a/go.mod b/go.modindex 83860ba101..8e1ffdf558 100644--- a/go.mod+++ b/go.mod@@ -25,14 +25,14 @@ require (github.com/prometheus/common v0.70.1github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529github.com/rs/zerolog v1.35.1- github.com/shirou/gopsutil/v4 v4.26.6+ github.com/shirou/gopsutil/v4 v4.26.8github.com/spf13/cobra v1.10.2github.com/stretchr/testify v1.11.1github.com/stripe/stripe-go/v82 v82.5.1golang.org/x/crypto v0.56.0golang.org/x/oauth2 v0.36.0golang.org/x/sync v0.22.0- golang.org/x/sys v0.47.0+ golang.org/x/sys v0.48.0golang.org/x/term v0.45.0gopkg.in/yaml.v3 v3.0.1k8s.io/api v0.37.0@@ -52,7 +52,7 @@ require (github.com/docker/go-connections v0.7.0 // indirectgithub.com/docker/go-units v0.5.0 // indirectgithub.com/dustin/go-humanize v1.0.1 // indirect- github.com/ebitengine/purego v0.10.0 // indirect+ github.com/ebitengine/purego v0.10.2 // indirectgithub.com/emicklei/go-restful/v3 v3.13.0 // indirectgithub.com/felixge/httpsnoop v1.0.4 // indirectgithub.com/fxamacker/cbor/v2 v2.9.1 // indirectdiff --git a/go.sum b/go.sumindex c3c106196b..2595794ed3 100644--- a/go.sum+++ b/go.sum@@ -32,6 +32,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpgithub.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=github.com/ebitengine/purego v0.10.0 h1:QIw4xfpWT6GWTzaW5XEKy3HXoqrJGx1ijYHzTF0/ISU=github.com/ebitengine/purego v0.10.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=+github.com/ebitengine/purego v0.10.2 h1:W809HbnvzAxgdm+aOvlSekrM16wGCdT/e76+9tS7gzE=+github.com/ebitengine/purego v0.10.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes=github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=@@ -199,6 +201,8 @@ github.com/russellhaering/goxmldsig v1.6.0/go.mod h1:TrnaquDcYxWXfJrOjeMBTX4mLBegithub.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=github.com/shirou/gopsutil/v4 v4.26.6 h1:Mzr/npDtQC/xpeEuQKHZt8Zo9CmPvhTj8nkR8w5TLDs=github.com/shirou/gopsutil/v4 v4.26.6/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=+github.com/shirou/gopsutil/v4 v4.26.8 h1:YQMTF/1J50B5+Y0vlo1eDRf5DoR7Gk69hY+8wjYkQeo=+github.com/shirou/gopsutil/v4 v4.26.8/go.mod h1:5O9FjBiXoTDFatIWjZZosqj4pV0DRtLx598xGbBehzM=github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=@@ -266,6 +270,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wgolang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=+golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=+golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=diff --git a/internal/hostmetrics/native_sampling_linux_test.go b/internal/hostmetrics/native_sampling_linux_test.gonew file mode 100644index 0000000000..2c78ac9ef0--- /dev/null+++ b/internal/hostmetrics/native_sampling_linux_test.go@@ -0,0 +1,69 @@+//go:build linux++package hostmetrics++import (+ "context"+ "math"+ "testing"+ "time"++ gocpu "github.com/shirou/gopsutil/v4/cpu"+ gomem "github.com/shirou/gopsutil/v4/mem"+ gonet "github.com/shirou/gopsutil/v4/net"+)++// Exercise the actual dependency's Linux parsers, not the collector's mocked+// wrappers. Do not enumerate usage on mounts: remote filesystems may block.+func TestNativeSamplingLinux(t *testing.T) {+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)+ defer cancel()+ first, err := gocpu.TimesWithContext(ctx, false)+ if err != nil || len(first) != 1 {+ t.Fatalf("CPU sample unavailable: count=%d err=%v", len(first), err)+ }+ second, err := gocpu.TimesWithContext(ctx, false)+ if err != nil || len(second) != 1 {+ t.Fatalf("second CPU sample unavailable: count=%d err=%v", len(second), err)+ }+ total, busy := cpuBusyTotal(first[0])+ later, _ := cpuBusyTotal(second[0])+ if math.IsNaN(total) || math.IsInf(total, 0) || total <= 0 || busy < 0 || busy > total || later < total {+ t.Fatal("invalid cumulative CPU accounting")+ }+ memory, err := gomem.VirtualMemoryWithContext(ctx)+ if err != nil {+ t.Fatalf("memory sample: %v", err)+ }+ if memory.Total == 0 || memory.Available > memory.Total || memory.Used > memory.Total {+ t.Fatal("invalid memory accounting")+ }+ interfaces, err := gonet.InterfacesWithContext(ctx)+ if err != nil || len(interfaces) == 0 {+ t.Fatalf("interface sample unavailable: count=%d err=%v", len(interfaces), err)+ }+ counters, err := gonet.IOCountersWithContext(ctx, true)+ if err != nil || len(counters) == 0 {+ t.Fatalf("network counters unavailable: count=%d err=%v", len(counters), err)+ }+ names := make(map[string]bool)+ for _, iface := range interfaces {+ names[iface.Name] = true+ }+ matched := false+ for _, counter := range counters {+ matched = matched || names[counter.Name]+ }+ if !matched {+ t.Fatal("network counters have no enumerated interface")+ }+ partitions, err := partitionsVisibleToAgent(ctx, true)+ if err != nil || len(partitions) == 0 {+ t.Fatalf("mount parser unavailable: count=%d err=%v", len(partitions), err)+ }+ for _, partition := range partitions {+ if partition.Mountpoint == "" || partition.Fstype == "" {+ t.Fatal("mount parser lost mountpoint or filesystem")+ }+ }+}