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.

Explain non-destructive recovery of a wrong agent node link

pulse-triage[bot]6c15ca72cad2
diff --git a/docs/API.md b/docs/API.md
index 13d741558c..a1fcc92ce2 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -1939,7 +1939,27 @@ Looks up an agent by ID or hostname/display name. Requires `agent:report`.
Agent self-unregister during uninstall: a token holding `agent:report` removes the agent that token owns. Without a token, only an admin session can remove an agent this way.
`POST /api/agents/agent/unlink` (admin, `settings:write`)
-Unlinks an agent from a node.
+Unlinks an agent from a Proxmox node without uninstalling the agent or removing
+the monitored node. Send the agent's exact canonical ID, not a display name,
+resource ID or node ID:
+
+```json
+{ "agentId": "canonical-agent-id" }
+```
+
+The agent keeps reporting. The explicit unlink is saved so automatic matching
+does not immediately reattach it, including after a server restart. This changes
+monitoring attribution; confirm that the agent and node really represent
+different machines before unlinking, and check their monitoring afterwards.
+Do not delete, reinstall or re-enrol an agent as a substitute.
+
+Older associations with unknown provenance are preserved rather than guessed to
+be automatic: an inference repair does not necessarily clear an existing link.
+See [a NAS shown as a Proxmox node](TROUBLESHOOTING.md#a-nas-is-shown-as-a-proxmox-node).
+This endpoint is distinct from `POST /api/resources/{id}/unlink`, whose
+`targetId` selects a resource pair, not an agent-to-node association. Keep the
+existing authentication and CSRF protections; never put credentials in a URL,
+command line or issue.
`DELETE /api/agents/agent/{agent_id}` (admin, `settings:write`)
Removes an agent from state.
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 8c6010aacb..8c3ae55e81 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -557,6 +557,28 @@ restore, not by overwriting today's history. Follow
### Monitoring Data
+#### A NAS is shown as a Proxmox node
+
+First distinguish a wrong node association from disks appearing in a shared
+storage view. Agent-reported physical disks can appear there without making
+their host a Proxmox cluster member. Compare the affected host's existing Pulse
+node/Machines rows with Proxmox's own inventory; use consistent private aliases
+when reporting a mismatch, not full API responses or configuration files.
+
+An update that prevents new false matches may leave an older association in
+place. Pulse preserves links with unknown legacy provenance because they might
+have been an operator's choice; repeated names or addresses alone are not enough
+to discard one.
+
+When the two records are confirmed to be different machines, an administrator
+using an existing authenticated API integration can explicitly
+[unlink the agent from the node](API.md#agent-management), using the exact agent
+ID and the documented JSON body. This saves the separation while the agent keeps
+reporting; it is not removal or reinstallation. Check both machines' attribution
+and alert coverage afterwards. Do not grant broader access, rename hosts, delete
+saved state or reinstall to diagnose the association. If the target or link is
+uncertain, retain it and [report the mismatch](#-getting-help) instead.
+
#### Unraid reports missing disks in empty slots
Compare the same host's **existing** Unraid status with Pulse's disk inventory,
diff --git a/frontend-modern/public/docs/API.md b/frontend-modern/public/docs/API.md
index 13d741558c..a1fcc92ce2 100644
--- a/frontend-modern/public/docs/API.md
+++ b/frontend-modern/public/docs/API.md
@@ -1939,7 +1939,27 @@ Looks up an agent by ID or hostname/display name. Requires `agent:report`.
Agent self-unregister during uninstall: a token holding `agent:report` removes the agent that token owns. Without a token, only an admin session can remove an agent this way.
`POST /api/agents/agent/unlink` (admin, `settings:write`)
-Unlinks an agent from a node.
+Unlinks an agent from a Proxmox node without uninstalling the agent or removing
+the monitored node. Send the agent's exact canonical ID, not a display name,
+resource ID or node ID:
+
+```json
+{ "agentId": "canonical-agent-id" }
+```
+
+The agent keeps reporting. The explicit unlink is saved so automatic matching
+does not immediately reattach it, including after a server restart. This changes
+monitoring attribution; confirm that the agent and node really represent
+different machines before unlinking, and check their monitoring afterwards.
+Do not delete, reinstall or re-enrol an agent as a substitute.
+
+Older associations with unknown provenance are preserved rather than guessed to
+be automatic: an inference repair does not necessarily clear an existing link.
+See [a NAS shown as a Proxmox node](TROUBLESHOOTING.md#a-nas-is-shown-as-a-proxmox-node).
+This endpoint is distinct from `POST /api/resources/{id}/unlink`, whose
+`targetId` selects a resource pair, not an agent-to-node association. Keep the
+existing authentication and CSRF protections; never put credentials in a URL,
+command line or issue.
`DELETE /api/agents/agent/{agent_id}` (admin, `settings:write`)
Removes an agent from state.
diff --git a/frontend-modern/public/docs/TROUBLESHOOTING.md b/frontend-modern/public/docs/TROUBLESHOOTING.md
index 8c6010aacb..8c3ae55e81 100644
--- a/frontend-modern/public/docs/TROUBLESHOOTING.md
+++ b/frontend-modern/public/docs/TROUBLESHOOTING.md
@@ -557,6 +557,28 @@ restore, not by overwriting today's history. Follow
### Monitoring Data
+#### A NAS is shown as a Proxmox node
+
+First distinguish a wrong node association from disks appearing in a shared
+storage view. Agent-reported physical disks can appear there without making
+their host a Proxmox cluster member. Compare the affected host's existing Pulse
+node/Machines rows with Proxmox's own inventory; use consistent private aliases
+when reporting a mismatch, not full API responses or configuration files.
+
+An update that prevents new false matches may leave an older association in
+place. Pulse preserves links with unknown legacy provenance because they might
+have been an operator's choice; repeated names or addresses alone are not enough
+to discard one.
+
+When the two records are confirmed to be different machines, an administrator
+using an existing authenticated API integration can explicitly
+[unlink the agent from the node](API.md#agent-management), using the exact agent
+ID and the documented JSON body. This saves the separation while the agent keeps
+reporting; it is not removal or reinstallation. Check both machines' attribution
+and alert coverage afterwards. Do not grant broader access, rename hosts, delete
+saved state or reinstall to diagnose the association. If the target or link is
+uncertain, retain it and [report the mismatch](#-getting-help) instead.
+
#### Unraid reports missing disks in empty slots
Compare the same host's **existing** Unraid status with Pulse's disk inventory,
diff --git a/scripts/tests/test_agent_unlink_docs.py b/scripts/tests/test_agent_unlink_docs.py
new file mode 100644
index 0000000000..dd9faf6517
--- /dev/null
+++ b/scripts/tests/test_agent_unlink_docs.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python3
+"""Keep the non-destructive agent unlink recipe aligned with its producer."""
+
+import json
+from pathlib import Path
+import re
+import unittest
+
+
+ROOT = Path(__file__).resolve().parents[2]
+
+
+class AgentUnlinkDocsTest(unittest.TestCase):
+ def test_example_matches_the_handler_and_client_request(self):
+ doc = (ROOT / "docs/API.md").read_text()
+ section = doc.split("`POST /api/agents/agent/unlink`", 1)[1].split(
+ "`DELETE /api/agents/agent/{agent_id}`", 1
+ )[0]
+ payload = json.loads(re.search(r"```json\n(.*?)\n```", section, re.S)[1])
+ handler = (ROOT / "internal/api/agent_ingest.go").read_text().split(
+ "func (h *UnifiedAgentHandlers) HandleUnlink(", 1
+ )[1].split("\nfunc ", 1)[0]
+ schema = handler.split("var req struct {", 1)[1].split("\n\t}", 1)[0]
+ self.assertEqual(set(payload), set(re.findall(r'json:"([^",]+)', schema)))
+ self.assertEqual(payload, {"agentId": "canonical-agent-id"})
+ self.assertIn("monitor.UnlinkHostAgent(agentID)", handler)
+ client = (ROOT / "frontend-modern/src/api/monitoring.ts").read_text().split(
+ "static async unlinkAgent(", 1
+ )[1].split("\n static ", 1)[0]
+ self.assertIn("/agents/agent/unlink", client)
+ self.assertRegex(client, r"JSON.stringify\(\{\s*agentId,")
+ self.assertIn("(admin, `settings:write`)", section)
+ self.assertNotIn("curl ", section)
+
+ def test_separation_is_distinguished_from_removal_and_resource_unlink(self):
+ doc = (ROOT / "docs/API.md").read_text()
+ section = doc.split("`POST /api/agents/agent/unlink`", 1)[1].split(
+ "`DELETE /api/agents/agent/{agent_id}`", 1
+ )[0]
+ self.assertIn("agent keeps reporting", section)
+ self.assertIn("including after a server restart", section)
+ self.assertIn("unknown provenance", section)
+ self.assertIn("`targetId`", section)
+ self.assertIn("CSRF", section)
+ self.assertIn("Do not delete, reinstall or re-enrol", section)
+
+ def test_help_keeps_ambiguous_identity_and_existing_state_safe(self):
+ doc = (ROOT / "docs/TROUBLESHOOTING.md").read_text()
+ section = doc.split("#### A NAS is shown as a Proxmox node", 1)[1].split(
+ "\n#### ", 1
+ )[0]
+ self.assertIn("API.md#agent-management", section)
+ self.assertIn("confirmed to be different machines", section)
+ self.assertIn("alert coverage afterwards", section)
+ self.assertIn("If the target or link is\nuncertain, retain it", section)
+ self.assertIn("not full API responses or configuration files", section)
+
+ def test_both_guides_match_the_shipped_documents(self):
+ for name in ("API.md", "TROUBLESHOOTING.md"):
+ with self.subTest(name=name):
+ self.assertEqual(
+ (ROOT / "docs" / name).read_bytes(),
+ (ROOT / "frontend-modern/public/docs" / name).read_bytes(),
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()