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.

Open the guest a filesystem alert belongs to

rcourtmandaa2baec74c4
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 38ccbdd1c4..758ab96fcc 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -4055,11 +4055,19 @@ the resource registry, opens the guest's drawer and reveals it, so a
notification reaches the affected guest in one tap instead of the top of a
page with every guest on it. Other alerts (hosts, storage, Docker
containers, Kubernetes, TrueNAS, Pulse system alerts) keep their platform
-page link, because their pages do not read `?resource=`. So do a guest's
-per-filesystem alerts (`<guest>-disk-<key>`, marked by `mountpoint` or
-`diskIndex` metadata) and orphaned backup alerts (`backup-subject:...`),
-whose ids name no resource the registry can open. The platform used
-for the monitoring policy menu is still read from the page path alone.
+page link, because their pages do not read `?resource=`. So do orphaned
+backup alerts (`backup-subject:...`), whose ids name no resource the
+registry can open. A guest's per-filesystem alert (`<guest>-disk-<key>`,
+marked by `mountpoint` or `diskIndex` metadata) names no registry resource
+either, so `CheckGuest` in `internal/alerts/guest.go` stamps its owning
+guest as `guestResourceId` metadata: the same guest ID the guest's own
+alerts are raised under, on the canonical-spec and legacy `checkMetric`
+paths alike (`TestGuestFilesystemAlertsNameOwningGuest`). The card links a
+filesystem alert to `?resource=<guestResourceId>`, opening the guest whose
+filesystem filled; a filesystem alert without that key (raised before the
+stamp) keeps the platform page link and never falls back to its own id.
+The platform used for the monitoring policy menu is still read from the
+page path alone.
### Thresholds lead with each group's default limits
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 11ccbbe661..ea1c598258 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -8689,7 +8689,9 @@ sets `aria-controls` only while its region is rendered.
`AlertOverviewAlertCard` builds a guest alert's link with
`buildWorkloadsRouteSearch({ resource })` and passes the alert's resource id
-unchanged. It adds no identity mapping of its own: the workloads selection
+unchanged, or for a per-filesystem alert the backend-stamped
+`guestResourceId` of the guest that owns the filesystem, also unchanged. It
+adds no identity mapping of its own: the workloads selection
state resolves non-row ids through the resource registry, and the summary
focus bridge reveals the selected row, so the alert link and every other
`?resource=` link share one resolution and reveal path.
diff --git a/frontend-modern/browser-verification/f23794bfc09d89b9.json b/frontend-modern/browser-verification/f23794bfc09d89b9.json
new file mode 100644
index 0000000000..ca0f3ffb78
--- /dev/null
+++ b/frontend-modern/browser-verification/f23794bfc09d89b9.json
@@ -0,0 +1,38 @@
+{
+ "version": 1,
+ "base_sha": "7dfe2b9c7f97018c3b8d5dfc5b41dc78a4517a2b",
+ "verified_at": "2026-10-13T08:20:00Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx": "892129cd308a908fef7bbc400a903b5861c8ba4d7ade502a98330d6521419e7c"
+ },
+ "routes": [
+ "/alerts/overview",
+ "/proxmox/overview"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 900
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "embedded production build of 7dfe2b9c7f plus this change (backend guestResourceId stamp and card), private mock stack (PULSE_MOCK_MODE, 4 nodes, 28 Proxmox guests) with the guest disk threshold lowered to 30% so filesystems alert",
+ "/api/alerts/active: all 34 filesystem alerts carry guestResourceId equal to their guest's id (VMs and the edge-proxy-01 LXC)",
+ "Alerts overview: filesystem alerts (orders-api-01 /, /logs, /data; edge-proxy-01 /) link to /proxmox/overview?resource=<owning guest id>, alongside guest-level alerts that keep their own id",
+ "1280px: edge-proxy-01 (LXC) opens with its drawer expanded and the row in view; its Filesystems panel shows / at 41%, the filesystem the alert names",
+ "375px and 800px: orders-api-01 (VM) opens with its drawer expanded and in view; its Filesystems panel shows / at 52% and /logs at 51%"
+ ],
+ "interactions": [
+ "1280px: click on the edge-proxy-01 Disk (/) alert name navigates to that guest's open drawer",
+ "375px: real tap on the orders-api-01 Disk (/logs) alert name navigates to that guest's open drawer; browser Back returns to /alerts/overview",
+ "800px: activating the orders-api-01 Disk (/) alert link opens the same guest"
+ ]
+}
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index c022d022e7..0e3763989c 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -240,14 +240,16 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
// platform page.
const resourceLink = (): string => {
const page = platformLink();
- const resourceId = props.alert.resourceId?.trim();
- const resourceType = props.alert.metadata?.resourceType;
+ const metadata = props.alert.metadata;
+ const resourceType = metadata?.resourceType;
// A per-filesystem alert names `<guest>-disk-<key>` and an orphaned backup
// names `backup-subject:...`; neither is a resource the registry can open.
- const namesSubResource =
- props.alert.metadata?.mountpoint !== undefined ||
- props.alert.metadata?.diskIndex !== undefined ||
- Boolean(resourceId?.startsWith('backup-subject:'));
+ // A filesystem alert that carries its guest's id opens that guest.
+ const isFilesystem = metadata?.mountpoint !== undefined || metadata?.diskIndex !== undefined;
+ const owningGuestId =
+ typeof metadata?.guestResourceId === 'string' ? metadata.guestResourceId.trim() : '';
+ const resourceId = isFilesystem ? owningGuestId : props.alert.resourceId?.trim();
+ const namesSubResource = Boolean(resourceId?.startsWith('backup-subject:'));
if (
!resourceId ||
namesSubResource ||
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
index 77e6fdb5c8..2e573fbf7b 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertOverviewAlertCard.system-scope.test.tsx
@@ -577,8 +577,26 @@ describe('Pulse system-alert overview scope', () => {
).toBe('/vmware/overview?resource=vm-vsphere-42');
});
+ it('opens the guest a filesystem alert carries', () => {
+ // The alert's own `<guest>-disk-<key>` id names no row; the backend
+ // stamps the guest it belongs to.
+ expect(
+ linkFor({
+ resourceId: 'mock-cluster-1-pve1-105-disk-root',
+ resourceName: 'postgres-replica-01',
+ metadata: {
+ resourceType: 'vm',
+ mountpoint: '/',
+ diskIndex: 0,
+ guestResourceId: 'mock-cluster-1-pve1-105',
+ },
+ }),
+ ).toBe('/proxmox/overview?resource=mock-cluster-1-pve1-105');
+ });
+
it('keeps the platform page for a guest filesystem or an orphaned backup', () => {
- // Per-filesystem alerts name `<guest>-disk-<key>`, which no row answers to.
+ // Per-filesystem alerts raised before the backend stamped the owning
+ // guest name only `<guest>-disk-<key>`, which no row answers to.
expect(
linkFor({
resourceId: 'mock-cluster-1-pve1-105-disk-root',
diff --git a/internal/alerts/guest.go b/internal/alerts/guest.go
index 310c4422b7..b9fc3b2723 100644
--- a/internal/alerts/guest.go
+++ b/internal/alerts/guest.go
@@ -354,6 +354,9 @@ func (m *Manager) CheckGuest(guest any, instanceName string) {
"diskIndex": idx,
"label": label,
"tags": append([]string(nil), snapshot.Tags...),
+ // The filesystem ID names no registry resource; this is the
+ // guest the alert belongs to, as its guest-level alerts name it.
+ "guestResourceId": guestID,
}
resourceType, ok := unifiedMetricResourceType(snapshot.resourceType())
if !ok {
diff --git a/internal/alerts/guest_snapshot_test.go b/internal/alerts/guest_snapshot_test.go
index 2f89b24eda..6d6e821fa8 100644
--- a/internal/alerts/guest_snapshot_test.go
+++ b/internal/alerts/guest_snapshot_test.go
@@ -2,6 +2,7 @@ package alerts
import (
"encoding/json"
+ "strings"
"testing"
"github.com/rcourtman/pulse-go-rewrite/internal/models"
@@ -184,3 +185,38 @@ func TestGuestIORateMetricsDistinguishValidZeroFromUnknown(t *testing.T) {
t.Fatalf("unknown rates became alert candidates: %+v %+v %+v %+v", diskRead, diskWrite, networkIn, networkOut)
}
}
+
+// A filesystem alert's resource ID ("<guest>-disk-<key>") names nothing the
+// resource registry can open, so it carries the guest it belongs to under
+// guestResourceId: the ID the guest's own alerts are raised under. Both the
+// canonical-spec path (VMs, containers) and the legacy checkMetric path (a
+// guest of unknown kind) stamp it.
+func TestGuestFilesystemAlertsNameOwningGuest(t *testing.T) {
+ vm := guestObservationVM()
+ legacy := guestSnapshotFromVM(vm)
+ legacy.Kind = guestKindUnknown
+ for name, guest := range map[string]any{"canonical": vm, "legacy": legacy} {
+ t.Run(name, func(t *testing.T) {
+ // Only the canonical guest raises a guest-level (memory) alert
+ // beside its filesystems; it ties the stamp to that alert's ID.
+ wantGuestLevel := name == "canonical"
+ m := guestObservationManager(t)
+ m.CheckGuest(guest, "site")
+ var filesystems int
+ var guestLevel bool
+ for _, alert := range m.GetActiveAlerts() {
+ if !strings.HasPrefix(alert.ResourceID, vm.ID+"-disk-") {
+ guestLevel = guestLevel || alert.ResourceID == vm.ID
+ continue
+ }
+ filesystems++
+ if got := alert.Metadata["guestResourceId"]; got != vm.ID {
+ t.Fatalf("filesystem alert %s guestResourceId = %v, want %q", alert.ResourceID, got, vm.ID)
+ }
+ }
+ if filesystems != 2 || guestLevel != wantGuestLevel {
+ t.Fatalf("expected two filesystem alerts (guest-level alert under %q: %v): %+v", vm.ID, wantGuestLevel, m.GetActiveAlerts())
+ }
+ })
+ }
+}