Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Avoid PVE linkage warnings for PBS agent profiles

[email protected]83dc17bf7136
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 8ded3613b1..f79f263201 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -19,6 +19,11 @@
Own polling, typed collection, runtime state assembly, and canonical monitoring
truth for live infrastructure data.
+Agent Doctor interprets Proxmox capability profiles according to the monitored
+product. Only PVE host profiles require a link to a PVE node; an explicit PBS
+profile, or an auto/missing-type host that matches a configured PBS instance by
+normalized hostname or reported address, must not receive the PVE-only
+`proxmox_profile_unlinked` warning.
Monitor construction also applies the persisted alert schedule's normalized
initial-delivery target to the tenant notification manager. This is runtime
wiring only: monitoring does not choose destinations or own notification
diff --git a/internal/monitoring/agent_fleet_doctor.go b/internal/monitoring/agent_fleet_doctor.go
index ff8a04cf31..f941c6120e 100644
--- a/internal/monitoring/agent_fleet_doctor.go
+++ b/internal/monitoring/agent_fleet_doctor.go
@@ -1120,7 +1120,17 @@ func diagnoseProfileCapabilityDrift(subject agentFleetSubject, state models.Stat
})
}
- if enabled, ok := configBool(profile.Config, "enable_proxmox"); ok && enabled && subject.host != nil && subject.host.LinkedNodeID == "" {
+ proxmoxType, _ := configString(profile.Config, "proxmox_type")
+ pbsProfile := strings.EqualFold(proxmoxType, "pbs")
+ pbsHost := !strings.EqualFold(proxmoxType, "pve") &&
+ subject.host != nil &&
+ hostMatchesPBSInstance(*subject.host, state.PBSInstances)
+ if enabled, ok := configBool(profile.Config, "enable_proxmox"); ok &&
+ enabled &&
+ !pbsProfile &&
+ !pbsHost &&
+ subject.host != nil &&
+ subject.host.LinkedNodeID == "" {
reasons = append(reasons, AgentFleetDiagnosticReason{
Code: "proxmox_profile_unlinked",
Severity: AgentFleetStatusWarning,
@@ -1254,6 +1264,48 @@ func configBool(config models.AgentConfigMap, key string) (bool, bool) {
}
}
+func configString(config models.AgentConfigMap, key string) (string, bool) {
+ raw, ok := config[key]
+ if !ok {
+ return "", false
+ }
+ value, ok := raw.(string)
+ if !ok {
+ return "", false
+ }
+ return strings.TrimSpace(value), true
+}
+
+func hostMatchesPBSInstance(host models.Host, instances []models.PBSInstance) bool {
+ hostName := unifiedresources.NormalizeHostname(host.Hostname)
+ reportedIPs := make(map[string]struct{})
+ if reportIP := unifiedresources.NormalizeIP(host.ReportIP); reportIP != "" {
+ reportedIPs[reportIP] = struct{}{}
+ }
+ for _, network := range host.NetworkInterfaces {
+ for _, address := range network.Addresses {
+ if ip := unifiedresources.NormalizeIP(address); ip != "" {
+ reportedIPs[ip] = struct{}{}
+ }
+ }
+ }
+
+ for _, instance := range instances {
+ endpointHost := extractHostname(instance.Host)
+ for _, candidate := range []string{instance.Name, endpointHost} {
+ if hostName != "" && unifiedresources.NormalizeHostname(candidate) == hostName {
+ return true
+ }
+ }
+ if endpointIP := unifiedresources.NormalizeIP(endpointHost); endpointIP != "" {
+ if _, ok := reportedIPs[endpointIP]; ok {
+ return true
+ }
+ }
+ }
+ return false
+}
+
func sortedAgentTypes(types map[string]struct{}) []string {
order := []string{"host", "docker", "kubernetes"}
out := make([]string, 0, len(types))
diff --git a/internal/monitoring/agent_fleet_doctor_test.go b/internal/monitoring/agent_fleet_doctor_test.go
index ee3d8062fe..ac18c512f9 100644
--- a/internal/monitoring/agent_fleet_doctor_test.go
+++ b/internal/monitoring/agent_fleet_doctor_test.go
@@ -429,6 +429,62 @@ func TestAgentFleetDiagnosticsDetectsMissingDockerTelemetryFromProfile(t *testin
}
}
+func TestDiagnoseProfileCapabilityDriftOnlyRequiresPVEProfilesToLinkToNodes(t *testing.T) {
+ host := models.Host{ID: "agent-1", Hostname: "pbs01"}
+ subject := agentFleetSubject{host: &host}
+
+ for _, test := range []struct {
+ name string
+ proxmoxType interface{}
+ pbsInstances []models.PBSInstance
+ wantReason bool
+ }{
+ {name: "PBS", proxmoxType: "pbs", wantReason: false},
+ {
+ name: "auto detected PBS",
+ proxmoxType: "auto",
+ pbsInstances: []models.PBSInstance{{
+ Name: "pbs01",
+ Host: "https://192.168.1.121:8007",
+ }},
+ wantReason: false,
+ },
+ {
+ name: "missing type on known PBS host",
+ proxmoxType: nil,
+ pbsInstances: []models.PBSInstance{{
+ Name: "pbs01",
+ Host: "https://192.168.1.121:8007",
+ }},
+ wantReason: false,
+ },
+ {name: "auto without PBS match", proxmoxType: "auto", wantReason: true},
+ {name: "PVE", proxmoxType: "pve", wantReason: true},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ profileConfig := models.AgentConfigMap{"enable_proxmox": true}
+ if test.proxmoxType != nil {
+ profileConfig["proxmox_type"] = test.proxmoxType
+ }
+ reasons := diagnoseProfileCapabilityDrift(
+ subject,
+ models.StateSnapshot{PBSInstances: test.pbsInstances},
+ models.AgentProfile{Config: profileConfig},
+ )
+
+ found := false
+ for _, reason := range reasons {
+ if reason.Code == "proxmox_profile_unlinked" {
+ found = true
+ }
+ }
+ if found != test.wantReason {
+ t.Fatalf("proxmox_profile_unlinked present = %v, want %v; reasons = %#v", found, test.wantReason, reasons)
+ }
+ })
+ }
+}
+
func TestAgentFleetDiagnosticsDetectsProfileVersionDrift(t *testing.T) {
now := time.Date(2026, 6, 29, 12, 0, 0, 0, time.UTC)
monitor := newAgentFleetDoctorTestMonitor(t)