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.

fix(fleet-doctor): name the judged credential id in the verdict evidence

rcourtmana1b379f0a032
diff --git a/internal/monitoring/agent_fleet_doctor.go b/internal/monitoring/agent_fleet_doctor.go
index f941c6120e..0f31a3b9b0 100644
--- a/internal/monitoring/agent_fleet_doctor.go
+++ b/internal/monitoring/agent_fleet_doctor.go
@@ -574,14 +574,18 @@ func diagnoseAgentCredential(subject agentFleetSubject, inventory agentFleetToke
Code: AgentFleetReasonCredentialExpired,
Severity: AgentFleetStatusCritical,
Message: "The credential last used by this agent has expired and can no longer authenticate.",
- Evidence: []string{"Credential status: expired"},
+ Evidence: []string{"Credential status: expired", "Credential id: " + tokenID},
}}
}
+ // The judged id is the token record UUID this host row last reported
+ // with, not secret material. Without it an operator cannot tell which
+ // credential the verdict is about, so a host that re-enrolled onto a
+ // fresh token but left a stale row behind reads as a live outage (#1730).
return []AgentFleetDiagnosticReason{{
Code: AgentFleetReasonCredentialMissing,
Severity: AgentFleetStatusCritical,
Message: "The credential last used by this agent no longer exists on this Pulse server.",
- Evidence: []string{"Credential status: missing or revoked"},
+ Evidence: []string{"Credential status: missing or revoked", "Credential id: " + tokenID},
}}
}
diff --git a/internal/monitoring/agent_fleet_doctor_test.go b/internal/monitoring/agent_fleet_doctor_test.go
index ac18c512f9..1b416f8158 100644
--- a/internal/monitoring/agent_fleet_doctor_test.go
+++ b/internal/monitoring/agent_fleet_doctor_test.go
@@ -82,6 +82,22 @@ func TestAgentFleetDiagnosticsDetectsMissingAndExpiredCredentials(t *testing.T)
if agent.Status != AgentFleetStatusCritical {
t.Fatalf("status = %q, want %q", agent.Status, AgentFleetStatusCritical)
}
+ // The verdict must name the credential it judged, or an operator
+ // cannot map it onto the token list to spot a stale host row.
+ foundJudgedID := false
+ for _, reason := range agent.Reasons {
+ if reason.Code != test.wantReason {
+ continue
+ }
+ for _, evidence := range reason.Evidence {
+ if evidence == "Credential id: "+test.tokenID {
+ foundJudgedID = true
+ }
+ }
+ }
+ if !foundJudgedID {
+ t.Fatalf("credential reason evidence does not name judged token id %q: %#v", test.tokenID, agent.Reasons)
+ }
if !hasSupportedRepair(agent, AgentFleetActionRepairAuthentication) {
t.Fatalf("expected safe authentication repair action: %#v", agent.RepairActions)
}