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
Distinguish Pulse service errors from failed TrueNAS polling
pulse-triage[bot]5bacce0f639f
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex 28802c951b..2c0e5540e4 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -581,13 +581,17 @@ notification configuration private.### TrueNAS#### "TrueNAS service unavailable"-- Ensure TrueNAS was added in **Settings → Infrastructure → Platform connections** with a valid HTTPS URL,- API key, and the username that owns the key.-- Check that the TrueNAS system is reachable from the Pulse server (default- HTTPS port).-- Verify the API-key owner has read access, then use **Test Connection** in- Pulse. TrueNAS 25.04 and later should report the `jsonrpc-websocket`- transport; TrueNAS 26 removed the former `/api/v2.0` REST endpoints.++The exact `truenas_unavailable` error (HTTP **500** or **503**) concerns Pulse's+connection-management handler or configuration persistence, not proof of an+appliance outage or an invalid TrueNAS API key. Keep the existing request's+status/code and time, then inspect a bounded Pulse log excerpt locally. Do not+rotate the key, recreate the connection or weaken TLS verification to clear it.++Follow [TrueNAS error diagnosis](TRUENAS.md#truenas-service-unavailable) to+separate this from an explicitly disabled integration or a failed live test.+For missing or stale readings, use the [polling checks](TRUENAS.md#stale-truenas-data);+a successful **Test Connection** does not prove collection has recovered.#### TrueNAS pools/datasets not appearing- TrueNAS data appears in the unified resource model and may take one configureddiff --git a/docs/TRUENAS.md b/docs/TRUENAS.mdindex 095acb8bfb..a1b7b1bf67 100644--- a/docs/TRUENAS.md+++ b/docs/TRUENAS.md@@ -214,14 +214,34 @@ HTTP status and a manually redacted error, never the full response or headers.### "TrueNAS service unavailable"-- Check that the TrueNAS system is reachable from the Pulse server.-- Verify the URL uses `https://`. Current TrueNAS releases require TLS for- remote API-key authentication.-- Verify that the configured username owns the API key and has permission to- read the monitored methods.-- Use **Test Connection** in Pulse. The connection's transport diagnostics- should report `jsonrpc-websocket` for TrueNAS 25.04 and later; do not test a- current appliance through the removed `/api/v2.0` REST endpoints.+This exact Pulse error (`truenas_unavailable`, HTTP **500** or **503**) means+Pulse's connection-management handler or configuration persistence is unavailable+for that request. It does **not** establish that the TrueNAS appliance is down,+that its API key is invalid, or that an ordinary poll failed.++Keep the existing failed request's path, HTTP status, error code and time from+your signed-in browser's **Developer tools → Network** panel; do not repeat a+save, delete or test to collect them. Inspect a bounded Pulse startup/service+log excerpt locally, using the readers below. Do not rotate the TrueNAS key,+recreate the saved connection or weaken TLS verification to clear this error.+Share only the Pulse version, request path, status/code and a manually redacted+error, not the full response, configuration, key or session cookie.++Distinguish these other results before choosing an action:++- **`truenas_disabled` / HTTP 404**: Pulse's TrueNAS integration is explicitly+ disabled. Check the intended `PULSE_ENABLE_TRUENAS` setting privately; this is+ not an appliance outage or an instruction to override an intentional opt-out.+- **`truenas_connection_failed` / HTTP 400**: a live connection test failed.+ Use its retained error to distinguish reachability, TLS, API-key ownership or+ read-permission problems. Keep HTTPS and certificate verification enabled;+ TrueNAS 25.04 and later use `jsonrpc-websocket`, while recognized CORE 13+ systems use legacy REST. Do not probe current TrueNAS through removed+ `/api/v2.0` endpoints or repeatedly test to diagnose ordinary collection.+- **Test succeeds but data is missing or stale**: Test reads system information+ on a separate connection, not inventory or metric collection. Use the+ [polling checks](#stale-truenas-data) and existing observation times instead+ of changing credentials or treating the test time as recovered freshness.### No data appearing after adding connection- Allow one configured polling cycle (60 seconds by default), not a fixeddiff --git a/frontend-modern/public/docs/TROUBLESHOOTING.md b/frontend-modern/public/docs/TROUBLESHOOTING.mdindex 28802c951b..2c0e5540e4 100644--- a/frontend-modern/public/docs/TROUBLESHOOTING.md+++ b/frontend-modern/public/docs/TROUBLESHOOTING.md@@ -581,13 +581,17 @@ notification configuration private.### TrueNAS#### "TrueNAS service unavailable"-- Ensure TrueNAS was added in **Settings → Infrastructure → Platform connections** with a valid HTTPS URL,- API key, and the username that owns the key.-- Check that the TrueNAS system is reachable from the Pulse server (default- HTTPS port).-- Verify the API-key owner has read access, then use **Test Connection** in- Pulse. TrueNAS 25.04 and later should report the `jsonrpc-websocket`- transport; TrueNAS 26 removed the former `/api/v2.0` REST endpoints.++The exact `truenas_unavailable` error (HTTP **500** or **503**) concerns Pulse's+connection-management handler or configuration persistence, not proof of an+appliance outage or an invalid TrueNAS API key. Keep the existing request's+status/code and time, then inspect a bounded Pulse log excerpt locally. Do not+rotate the key, recreate the connection or weaken TLS verification to clear it.++Follow [TrueNAS error diagnosis](TRUENAS.md#truenas-service-unavailable) to+separate this from an explicitly disabled integration or a failed live test.+For missing or stale readings, use the [polling checks](TRUENAS.md#stale-truenas-data);+a successful **Test Connection** does not prove collection has recovered.#### TrueNAS pools/datasets not appearing- TrueNAS data appears in the unified resource model and may take one configureddiff --git a/frontend-modern/public/docs/TRUENAS.md b/frontend-modern/public/docs/TRUENAS.mdindex 095acb8bfb..a1b7b1bf67 100644--- a/frontend-modern/public/docs/TRUENAS.md+++ b/frontend-modern/public/docs/TRUENAS.md@@ -214,14 +214,34 @@ HTTP status and a manually redacted error, never the full response or headers.### "TrueNAS service unavailable"-- Check that the TrueNAS system is reachable from the Pulse server.-- Verify the URL uses `https://`. Current TrueNAS releases require TLS for- remote API-key authentication.-- Verify that the configured username owns the API key and has permission to- read the monitored methods.-- Use **Test Connection** in Pulse. The connection's transport diagnostics- should report `jsonrpc-websocket` for TrueNAS 25.04 and later; do not test a- current appliance through the removed `/api/v2.0` REST endpoints.+This exact Pulse error (`truenas_unavailable`, HTTP **500** or **503**) means+Pulse's connection-management handler or configuration persistence is unavailable+for that request. It does **not** establish that the TrueNAS appliance is down,+that its API key is invalid, or that an ordinary poll failed.++Keep the existing failed request's path, HTTP status, error code and time from+your signed-in browser's **Developer tools → Network** panel; do not repeat a+save, delete or test to collect them. Inspect a bounded Pulse startup/service+log excerpt locally, using the readers below. Do not rotate the TrueNAS key,+recreate the saved connection or weaken TLS verification to clear this error.+Share only the Pulse version, request path, status/code and a manually redacted+error, not the full response, configuration, key or session cookie.++Distinguish these other results before choosing an action:++- **`truenas_disabled` / HTTP 404**: Pulse's TrueNAS integration is explicitly+ disabled. Check the intended `PULSE_ENABLE_TRUENAS` setting privately; this is+ not an appliance outage or an instruction to override an intentional opt-out.+- **`truenas_connection_failed` / HTTP 400**: a live connection test failed.+ Use its retained error to distinguish reachability, TLS, API-key ownership or+ read-permission problems. Keep HTTPS and certificate verification enabled;+ TrueNAS 25.04 and later use `jsonrpc-websocket`, while recognized CORE 13+ systems use legacy REST. Do not probe current TrueNAS through removed+ `/api/v2.0` endpoints or repeatedly test to diagnose ordinary collection.+- **Test succeeds but data is missing or stale**: Test reads system information+ on a separate connection, not inventory or metric collection. Use the+ [polling checks](#stale-truenas-data) and existing observation times instead+ of changing credentials or treating the test time as recovered freshness.### No data appearing after adding connection- Allow one configured polling cycle (60 seconds by default), not a fixeddiff --git a/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.ts b/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.tsnew file mode 100644index 0000000000..be7938449d--- /dev/null+++ b/frontend-modern/src/features/docs/__tests__/truenasErrorGuide.test.ts@@ -0,0 +1,95 @@+import { readFileSync } from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, it } from 'vitest';+import { renderDocMarkdown } from '../docMarkdown';++const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');++function renderGuide(name: string): HTMLElement {+ // An exact-parent input proves that the former advice fails these checks+ // without altering the committed source used by the proof.+ const input = process.env[`PULSE_${name}_GUIDE_TEST_INPUT`];+ const source = readFileSync(+ input ?? path.join(repoRoot, 'frontend-modern/public/docs', `${name}.md`),+ 'utf8',+ );+ const article = document.createElement('article');+ article.innerHTML = renderDocMarkdown(source, name);+ return article;+}++function unavailableSection(article: HTMLElement): HTMLElement {+ const heading = article.querySelector('#truenas-service-unavailable');+ expect(heading).not.toBeNull();+ const section = document.createElement('section');+ for (let next = heading!.nextElementSibling; next; next = next.nextElementSibling) {+ if (/^H[1-4]$/.test(next.tagName)) break;+ section.appendChild(next.cloneNode(true));+ }+ return section;+}++const prose = (section: HTMLElement): string =>+ (section.textContent ?? '').replace(/\s+/g, ' ').trim();++describe('shipped TrueNAS error diagnosis', () => {+ it.each(['TRUENAS', 'TROUBLESHOOTING'])(+ '%s routes local service errors away from appliance credentials and live tests',+ (name) => {+ const section = unavailableSection(renderGuide(name));+ const text = prose(section);+ expect(text).toContain('truenas_unavailable');+ expect(text).toContain('500');+ expect(text).toContain('503');+ expect(text).toContain('connection-management handler or configuration persistence');+ expect(text).toContain('bounded Pulse');+ expect(text).toMatch(/Do not rotate the (?:TrueNAS )?key, recreate/);+ expect(text).toContain('weaken TLS verification');+ expect(section.querySelector('pre')).toBeNull();+ expect(text).not.toContain('then use Test Connection');+ expect(text).not.toContain('Use Test Connection in Pulse.');+ },+ );++ it('keeps explicit opt-out and an actual failed probe distinct from unavailable storage', () => {+ const text = prose(unavailableSection(renderGuide('TRUENAS')));+ expect(text).toContain('truenas_disabled / HTTP 404');+ expect(text).toContain('PULSE_ENABLE_TRUENAS');+ expect(text).toContain('not an appliance outage');+ expect(text).toContain('override an intentional opt-out');+ expect(text).toContain('truenas_connection_failed / HTTP 400');+ expect(text).toContain('a live connection test failed');+ expect(text).toContain('Keep HTTPS and certificate verification enabled');+ expect(text).toContain('recognized CORE 13 systems use legacy REST');+ });++ it('uses existing browser evidence and does not require replay or public credentials', () => {+ const text = prose(unavailableSection(renderGuide('TRUENAS')));+ expect(text).toContain('existing failed request');+ expect(text).toContain('Developer tools → Network');+ expect(text).toContain('do not repeat a save, delete or test');+ expect(text).toContain('request path, status/code and a manually redacted error');+ expect(text).toContain('not the full response, configuration, key or session cookie');+ expect(text).toContain('on a separate connection, not inventory or metric collection');+ expect(text).toContain('instead of changing credentials');+ });++ it('takes both entry points to real error and polling headings in the shipped viewer', () => {+ const guide = renderGuide('TRUENAS');+ const troubleshooting = unavailableSection(renderGuide('TROUBLESHOOTING'));+ const errorLink = troubleshooting.querySelector<HTMLAnchorElement>(+ 'a[href="/docs/TRUENAS#truenas-service-unavailable"]',+ );+ expect(errorLink?.textContent).toBe('TrueNAS error diagnosis');+ expect(guide.querySelector(new URL(errorLink!.href).hash)?.textContent).toBe(+ '"TrueNAS service unavailable"',+ );+ expect(+ troubleshooting.querySelector('a[href="/docs/TRUENAS#stale-truenas-data"]'),+ ).not.toBeNull();+ const pollingLink = unavailableSection(guide).querySelector('a[href="#stale-truenas-data"]');+ expect(pollingLink?.textContent).toBe('polling checks');+ expect(guide.querySelector('#stale-truenas-data')?.textContent).toBe('Stale TrueNAS data');+ });+});diff --git a/internal/api/truenas_guidance_test.go b/internal/api/truenas_guidance_test.gonew file mode 100644index 0000000000..6df9d59cff--- /dev/null+++ b/internal/api/truenas_guidance_test.go@@ -0,0 +1,112 @@+package api++import (+ "bytes"+ "context"+ "encoding/json"+ "errors"+ "net/http"+ "net/http/httptest"+ "testing"++ "github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/internal/truenas"+)++// Bind the help's distinctions to actual responses without contacting an+// appliance, changing a connection or running an ordinary poll.+func TestTrueNASGuidanceUnavailableIsLocalPersistence(t *testing.T) {+ setTrueNASFeatureForTest(t, true)+ setMockModeForTest(t, false)+ for _, tc := range []struct {+ name string+ handler *TrueNASHandlers+ }{+ {"nil handler", nil},+ {"missing resolver", &TrueNASHandlers{}},+ {"unavailable request persistence", &TrueNASHandlers{+ getPersistence: func(context.Context) *config.ConfigPersistence { return nil },+ }},+ } {+ t.Run(tc.name, func(t *testing.T) {+ clientCalls := 0+ if tc.handler != nil {+ tc.handler.newClient = func(truenas.ClientConfig) (trueNASClient, error) {+ clientCalls+++ t.Fatal("local persistence failure must not contact TrueNAS")+ return nil, nil+ }+ }+ for _, action := range []struct {+ name, method, path string+ handle http.HandlerFunc+ }{+ {"list", http.MethodGet, "/api/truenas/connections", tc.handler.HandleList},+ {"saved test", http.MethodPost, "/api/truenas/connections/example/test", tc.handler.HandleTestSavedConnection},+ } {+ t.Run(action.name, func(t *testing.T) {+ rec := httptest.NewRecorder()+ action.handle(rec, httptest.NewRequest(action.method, action.path, nil))+ assertTrueNASGuidanceError(t, rec, http.StatusInternalServerError, "truenas_unavailable", "TrueNAS service unavailable")+ })+ }+ if clientCalls != 0 {+ t.Fatalf("unexpected appliance clients: %d", clientCalls)+ }+ })+ }+}++func TestTrueNASGuidanceUnavailableRouteIsLocalHandler(t *testing.T) {+ router := &Router{}+ handle := router.platformConnectionItemRoute("truenas_unavailable", "TrueNAS service unavailable", func() *platformConnectionItemHandlers { return nil })+ rec := httptest.NewRecorder()+ handle(rec, httptest.NewRequest(http.MethodPost, "/api/truenas/connections/example/test", nil))+ assertTrueNASGuidanceError(t, rec, http.StatusServiceUnavailable, "truenas_unavailable", "TrueNAS service unavailable")+}++func TestTrueNASGuidanceDisabledIsNotApplianceFailure(t *testing.T) {+ setTrueNASFeatureForTest(t, false)+ handler := &TrueNASHandlers{getPersistence: func(context.Context) *config.ConfigPersistence {+ t.Fatal("explicit opt-out must stop before storage or appliance access")+ return nil+ }}+ rec := httptest.NewRecorder()+ handler.HandleList(rec, httptest.NewRequest(http.MethodGet, "/api/truenas/connections", nil))+ assertTrueNASGuidanceError(t, rec, http.StatusNotFound, "truenas_disabled", "TrueNAS integration has been explicitly disabled")+}++func TestTrueNASGuidanceFailedProbeIsNotServiceUnavailable(t *testing.T) {+ setTrueNASFeatureForTest(t, true)+ clientCalls, probeCalls := 0, 0+ handler := &TrueNASHandlers{newClient: func(truenas.ClientConfig) (trueNASClient, error) {+ clientCalls+++ return &fakeTrueNASClient{testConnection: func(context.Context) error {+ probeCalls+++ return errors.New("synthetic probe failure")+ }}, nil+ }}+ body := marshalTrueNASRequest(t, map[string]any{+ "host": "https://nas.example.test", "apiKey": "synthetic-key", "username": "synthetic-reader",+ })+ rec := httptest.NewRecorder()+ handler.HandleTestConnection(rec, httptest.NewRequest(http.MethodPost, "/api/truenas/connections/test", bytes.NewReader(body)))+ assertTrueNASGuidanceError(t, rec, http.StatusBadRequest, "truenas_connection_failed", "Failed to connect to TrueNAS")+ if clientCalls != 1 || probeCalls != 1 {+ t.Fatalf("expected one synthetic test, got %d clients / %d probes", clientCalls, probeCalls)+ }+}++func assertTrueNASGuidanceError(t *testing.T, rec *httptest.ResponseRecorder, status int, code, message string) {+ t.Helper()+ var response APIError+ if err := json.Unmarshal(rec.Body.Bytes(), &response); err != nil {+ t.Fatalf("decode response: %v", err)+ }+ if rec.Code != status || response.StatusCode != status || response.Code != code || response.ErrorMessage != message {+ t.Fatalf("got HTTP %d / %+v; expected HTTP %d / %s / %s", rec.Code, response, status, code, message)+ }+ if rec.Header().Get("Content-Type") != "application/json" {+ t.Fatalf("unexpected response type: %s", rec.Header().Get("Content-Type"))+ }+}