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
Fix Windows agent TLS install and disk summary
[email protected]44b89f5af2a7
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsxindex 8f201b5486..216ce15c19 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx@@ -1,7 +1,12 @@import { For, Show, createMemo } from 'solid-js';import type { Component } from 'solid-js';-import type { Disk } from '@/types/api';-import { formatBytes, formatSpeed, formatUptime, normalizeDiskArray } from '@/utils/format';+import {+ formatBytes,+ formatSpeed,+ formatUptime,+ getResourceDiskSummary,+ normalizeDiskArray,+} from '@/utils/format';import { formatTemperature, getTemperatureTextClass } from '@/utils/temperature';import {GROUPED_TABLE_ROW_BADGE_CLASS,@@ -59,7 +64,7 @@ import {} from './useUnifiedResourceTableState';import { shouldShowClusterGroupTypeLabel } from './unifiedResourceTableStateModel';import { getOutlierEmphasis, isResourceOnline } from './unifiedResourceTableModel';-import { type Resource, getCpuPercent, getDiskPercent, getMemoryPercent } from '@/types/resource';+import { type Resource, getCpuPercent, getMemoryPercent } from '@/types/resource';interface UnifiedResourceHostTableCardProps {tableProps: UnifiedResourceTableProps;@@ -302,9 +307,11 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCarconst memoryPercentValue = createMemo(() =>resource.memory ? Math.round(getMemoryPercent(resource)) : null,);- const diskPercentValue = createMemo(() =>- resource.disk ? Math.round(getDiskPercent(resource)) : null,- );+ const diskSummary = createMemo(() => getResourceDiskSummary(resource));+ const diskPercentValue = createMemo(() => {+ const summary = diskSummary();+ return summary ? Math.round(summary.usage) : null;+ });const memorySublabel = createMemo(() => {if (@@ -317,13 +324,9 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar});const diskSublabel = createMemo(() => {- if (- !resource.disk ||- resource.disk.used === undefined ||- resource.disk.total === undefined- )- return undefined;- return `${formatBytes(resource.disk.used)}/${formatBytes(resource.disk.total)}`;+ const summary = diskSummary();+ if (!summary) return undefined;+ return `${formatBytes(summary.used)}/${formatBytes(summary.total)}`;});const networkTotal = createMemo(() => (resource.network?.rxBytes ?? 0) + (resource.network?.txBytes ?? 0),@@ -535,16 +538,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar<div class="w-full" title={diskSublabel()}><StackedDiskBardisks={normalizeDiskArray(resource.agent?.disks)}- aggregateDisk={- resource.disk- ? ({- total: resource.disk.total ?? 0,- used: resource.disk.used ?? 0,- free: resource.disk.free ?? 0,- usage: resource.disk.current ?? 0,- } as Disk)- : undefined- }+ aggregateDisk={diskSummary()}thresholds={diskThresholds()}/></div>diff --git a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.tsindex c4197fbace..d71e08b279 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts+++ b/frontend-modern/src/components/Infrastructure/__tests__/infrastructureSelectors.test.ts@@ -296,6 +296,29 @@ describe('infrastructureSelectors', () => {'resource-3',]);});++ it('sorts by aggregate agent disks when the canonical disk summary is absent', () => {+ const resources = [+ makeResource(1, {+ displayName: 'Higher usage',+ agent: { disks: [{ total: 100, used: 80, free: 20 }] },+ }),+ makeResource(2, {+ displayName: 'Lower usage',+ agent: {+ disks: [+ { total: 100, used: 10, free: 90 },+ { total: 300, used: 30, free: 270 },+ ],+ },+ }),+ ];++ expect(sortResources(resources, 'disk', 'asc').map((resource) => resource.id)).toEqual([+ 'resource-2',+ 'resource-1',+ ]);+ });});describe('groupResources', () => {diff --git a/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts b/frontend-modern/src/components/Infrastructure/infrastructureSelectors.tsindex 07c3aad109..230feaee75 100644--- a/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts+++ b/frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts@@ -1,10 +1,11 @@import type { Resource } from '@/types/resource';-import { getCpuPercent, getDiskPercent, getMemoryPercent } from '@/types/resource';+import { getCpuPercent, getMemoryPercent } from '@/types/resource';import { getPreferredInfrastructureDisplayName } from '@/utils/resourceIdentity';import { getInfrastructureSystemIdentitySortLabel } from '@/utils/resourceBadgePresentation';import { normalizeSourcePlatformKey, type KnownSourcePlatform } from '@/utils/sourcePlatforms';import { getCanonicalStatusLabel, STATUS_SORT_ORDER } from '@/utils/status';import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';+import { getResourceDiskSummary } from '@/utils/format';export interface IODistributionStats {median: number;@@ -81,7 +82,7 @@ const getSortValue = (resource: Resource, key: string): number | string | null =case 'memory':return resource.memory ? getMemoryPercent(resource) : null;case 'disk':- return resource.disk ? getDiskPercent(resource) : null;+ return getResourceDiskSummary(resource)?.usage ?? null;case 'network':return resource.network ? resource.network.rxBytes + resource.network.txBytes : null;case 'diskio':diff --git a/frontend-modern/src/utils/__tests__/agentInstallCommand.branchcov0720pm.test.ts b/frontend-modern/src/utils/__tests__/agentInstallCommand.branchcov0720pm.test.tsindex f29ce2e92d..07bb9acfe5 100644--- a/frontend-modern/src/utils/__tests__/agentInstallCommand.branchcov0720pm.test.ts+++ b/frontend-modern/src/utils/__tests__/agentInstallCommand.branchcov0720pm.test.ts@@ -113,7 +113,7 @@ describe('buildPowerShellInstallScriptBootstrap — bootstrap script wiring', ()'$pulsePrev = [System.Net.ServicePointManager]::ServerCertificateValidationCallback;',);expect(script).toContain(- '[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { param($sender, $certificate, $chain, $sslPolicyErrors)',+ '[System.Net.ServicePointManager]::ServerCertificateValidationCallback = ({ param($sender, $certificate, $chain, $sslPolicyErrors)',);expect(script).toContain('} finally { [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $pulsePrev }',@@ -122,7 +122,9 @@ describe('buildPowerShellInstallScriptBootstrap — bootstrap script wiring', ()it('short-circuits the callback to $true when PULSE_INSECURE_SKIP_VERIFY is "true"', () => {const script = buildPowerShellInstallScriptBootstrap('https://pulse.example');- expect(script).toContain('if ($env:PULSE_INSECURE_SKIP_VERIFY -eq "true") { return $true };');+ expect(script).toContain(+ 'if ($env:PULSE_INSECURE_SKIP_VERIFY -eq "true") { [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { param($sender, $certificate, $chain, $sslPolicyErrors) return $true }',+ );});it('returns the raw sslPolicyErrors verdict when no custom CA was loaded', () => {@@ -155,7 +157,7 @@ describe('buildPowerShellInstallScriptBootstrap — bootstrap script wiring', ()expect(script).toContain('if ($pulseElement.Certificate.Thumbprint -eq $pulseCustomCa.Thumbprint) { return $true }',);- expect(script).toContain('return $false };');+ expect(script).toContain('return $false }).GetNewClosure()');});it('fetches the script via `irm $pulseScriptUrl` inside both the custom-trust and the bare else arm', () => {diff --git a/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts b/frontend-modern/src/utils/__tests__/agentInstallCommand.test.tsindex fb860d554c..38d7efbdf3 100644--- a/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts+++ b/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts@@ -143,6 +143,10 @@ describe('agentInstallCommand', () => {expect(command).toContain('Invoke-WebRequest -Uri $pulseScriptUrl -UseBasicParsing -OutFile $pulseInstallScript',);+ expect(command).toContain(+ 'ServerCertificateValidationCallback={ param($sender,$certificate,$chain,$sslPolicyErrors) return $true }',+ );+ expect(command).not.toContain('$pulseAllowInsecure');expect(command).toContain('& $pulsePowerShell -NoProfile -ExecutionPolicy Bypass -File $pulseInstallScript -Url',);@@ -154,6 +158,18 @@ describe('agentInstallCommand', () => {expect(command).not.toContain('$env:PULSE_TOKEN=');});+ it('captures a custom CA in the certificate callback when TLS verification stays enabled', () => {+ const command = buildWindowsAgentInstallCommand({+ baseUrl: 'https://pulse.example',+ token: null,+ caCertPath: 'C:\\Pulse\\custom-ca.cer',+ });++ expect(command).toContain('ServerCertificateValidationCallback=({ param(');+ expect(command).toContain('return $false }).GetNewClosure()');+ expect(command).not.toContain('return $true }; if ($null -eq $pulseCustomCa)');+ });+it('supports tokenless shared Windows install transport for optional auth', () => {const command = buildWindowsAgentInstallCommand({baseUrl: 'https://pulse.example',diff --git a/frontend-modern/src/utils/__tests__/formatExtra.test.ts b/frontend-modern/src/utils/__tests__/formatExtra.test.tsindex 7f4a0e13f2..b56e232856 100644--- a/frontend-modern/src/utils/__tests__/formatExtra.test.ts+++ b/frontend-modern/src/utils/__tests__/formatExtra.test.ts@@ -3,6 +3,7 @@ import {formatPowerOnHours,estimateTextWidth,formatAnomalyRatio,+ getResourceDiskSummary,getShortImageName,normalizeDiskArray,ANOMALY_SEVERITY_CLASS,@@ -264,3 +265,33 @@ describe('normalizeDiskArray', () => {).toBeUndefined();});});++describe('getResourceDiskSummary', () => {+ it('aggregates multiple agent-reported Windows volumes when the resource summary is absent', () => {+ const gib = 1024 ** 3;+ const summary = getResourceDiskSummary({+ disk: undefined,+ agent: {+ disks: [+ { device: 'C:', mountpoint: 'C:\\', total: 499 * gib, used: 49.5 * gib },+ { device: 'F:', mountpoint: 'F:\\', total: 250 * gib, used: 2.75 * gib },+ ],+ },+ });++ expect(summary).toMatchObject({+ total: 749 * gib,+ used: 52.25 * gib,+ });+ expect(summary?.usage).toBeCloseTo(6.98, 2);+ });++ it('keeps the canonical resource summary when one is available', () => {+ expect(+ getResourceDiskSummary({+ disk: { current: 25, total: 400, used: 100, free: 300 },+ agent: { disks: [{ total: 1000, used: 900 }] },+ }),+ ).toEqual({ total: 400, used: 100, free: 300, usage: 25 });+ });+});diff --git a/frontend-modern/src/utils/agentInstallCommand.ts b/frontend-modern/src/utils/agentInstallCommand.tsindex 10518ae22c..d8a8bda8ce 100644--- a/frontend-modern/src/utils/agentInstallCommand.ts+++ b/frontend-modern/src/utils/agentInstallCommand.ts@@ -131,8 +131,10 @@ export const buildPowerShellInstallScriptBootstrap = (baseUrl: string) => {`}; ` +`$pulsePrev = [System.Net.ServicePointManager]::ServerCertificateValidationCallback; ` +`try { ` +- `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { param($sender, $certificate, $chain, $sslPolicyErrors) ` +- `if ($env:PULSE_INSECURE_SKIP_VERIFY -eq "true") { return $true }; ` ++ `if ($env:PULSE_INSECURE_SKIP_VERIFY -eq "true") { ` ++ `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { param($sender, $certificate, $chain, $sslPolicyErrors) return $true } ` ++ `} else { ` ++ `[System.Net.ServicePointManager]::ServerCertificateValidationCallback = ({ param($sender, $certificate, $chain, $sslPolicyErrors) ` +`if ($null -eq $pulseCustomCa) { return $sslPolicyErrors -eq [System.Net.Security.SslPolicyErrors]::None }; ` +`if ($null -eq $certificate) { return $false }; ` +`$pulseChain = [System.Security.Cryptography.X509Certificates.X509Chain]::new(); ` +@@ -142,7 +144,8 @@ export const buildPowerShellInstallScriptBootstrap = (baseUrl: string) => {`foreach ($pulseElement in $pulseChain.ChainElements) { ` +`if ($pulseElement.Certificate.Thumbprint -eq $pulseCustomCa.Thumbprint) { return $true } ` +`}; ` +- `return $false }; ` ++ `return $false }).GetNewClosure() ` ++ `}; ` +`irm $pulseScriptUrl ` +`} finally { [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $pulsePrev } ` +`} else { irm $pulseScriptUrl } } | iex`@@ -172,8 +175,11 @@ export const buildWindowsAgentInstallCommand = ({`-Url "${powerShellQuote(normalizedBaseUrl)}"`,...(normalizedToken ? ['-TokenFile $pulseTokenFile'] : []),];+ const certificateValidationCallback = insecure+ ? `{ param($sender,$certificate,$chain,$sslPolicyErrors) return $true }`+ : `({ param($sender,$certificate,$chain,$sslPolicyErrors) if ($null -eq $pulseCustomCa) { return $sslPolicyErrors -eq [System.Net.Security.SslPolicyErrors]::None }; if ($null -eq $certificate) { return $false }; $pulseChain=[System.Security.Cryptography.X509Certificates.X509Chain]::new(); $pulseChain.ChainPolicy.RevocationMode=[System.Security.Cryptography.X509Certificates.X509RevocationMode]::NoCheck; $null=$pulseChain.ChainPolicy.ExtraStore.Add($pulseCustomCa); $null=$pulseChain.Build($certificate); foreach ($pulseElement in $pulseChain.ChainElements) { if ($pulseElement.Certificate.Thumbprint -eq $pulseCustomCa.Thumbprint) { return $true } }; return $false }).GetNewClosure()`;const customTrustFetch = installerFetchRequiresCustomTrust- ? `$pulseCustomCa=$null; if (-not [string]::IsNullOrWhiteSpace($pulseCaCertPath)) { $pulseCustomCaBytes=[System.IO.File]::ReadAllBytes($pulseCaCertPath); $pulseCustomCaText=[System.Text.Encoding]::ASCII.GetString($pulseCustomCaBytes); if ($pulseCustomCaText.Contains("-----BEGIN CERTIFICATE-----")) { $pulseCustomCa=[System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromPem($pulseCustomCaText) } else { $pulseCustomCa=[System.Security.Cryptography.X509Certificates.X509Certificate2]::new($pulseCustomCaBytes) } }; $pulsePrev=[System.Net.ServicePointManager]::ServerCertificateValidationCallback; try { [System.Net.ServicePointManager]::ServerCertificateValidationCallback={ param($sender,$certificate,$chain,$sslPolicyErrors) if ($pulseAllowInsecure) { return $true }; if ($null -eq $pulseCustomCa) { return $sslPolicyErrors -eq [System.Net.Security.SslPolicyErrors]::None }; if ($null -eq $certificate) { return $false }; $pulseChain=[System.Security.Cryptography.X509Certificates.X509Chain]::new(); $pulseChain.ChainPolicy.RevocationMode=[System.Security.Cryptography.X509Certificates.X509RevocationMode]::NoCheck; $null=$pulseChain.ChainPolicy.ExtraStore.Add($pulseCustomCa); $null=$pulseChain.Build($certificate); foreach ($pulseElement in $pulseChain.ChainElements) { if ($pulseElement.Certificate.Thumbprint -eq $pulseCustomCa.Thumbprint) { return $true } }; return $false }; Invoke-WebRequest -Uri $pulseScriptUrl -UseBasicParsing -OutFile $pulseInstallScript } finally { [System.Net.ServicePointManager]::ServerCertificateValidationCallback=$pulsePrev }`+ ? `$pulseCustomCa=$null; if (-not [string]::IsNullOrWhiteSpace($pulseCaCertPath)) { $pulseCustomCaBytes=[System.IO.File]::ReadAllBytes($pulseCaCertPath); $pulseCustomCaText=[System.Text.Encoding]::ASCII.GetString($pulseCustomCaBytes); if ($pulseCustomCaText.Contains("-----BEGIN CERTIFICATE-----")) { $pulseCustomCa=[System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromPem($pulseCustomCaText) } else { $pulseCustomCa=[System.Security.Cryptography.X509Certificates.X509Certificate2]::new($pulseCustomCaBytes) } }; $pulsePrev=[System.Net.ServicePointManager]::ServerCertificateValidationCallback; try { [System.Net.ServicePointManager]::ServerCertificateValidationCallback=${certificateValidationCallback}; Invoke-WebRequest -Uri $pulseScriptUrl -UseBasicParsing -OutFile $pulseInstallScript } finally { [System.Net.ServicePointManager]::ServerCertificateValidationCallback=$pulsePrev }`: `Invoke-WebRequest -Uri $pulseScriptUrl -UseBasicParsing -OutFile $pulseInstallScript`;const tokenBootstrap = normalizedToken@@ -194,7 +200,6 @@ export const buildWindowsAgentInstallCommand = ({`New-Item -ItemType Directory -Force -Path $pulseTmp | Out-Null; ` +`$pulseInstallScript=Join-Path $pulseTmp "install.ps1"; ` +`$pulseScriptUrl="${scriptUrl}"; ` +- `$pulseAllowInsecure=${insecure ? '$true' : '$false'}; ` +`$pulseCaCertPath="${powerShellQuote(normalizedCaCertPath)}"; ` +`try { ` +`${customTrustFetch}; ` +diff --git a/frontend-modern/src/utils/format.ts b/frontend-modern/src/utils/format.tsindex 230f950334..5e13d39bd1 100644--- a/frontend-modern/src/utils/format.ts+++ b/frontend-modern/src/utils/format.ts@@ -1,5 +1,6 @@// Type-safe formatting utilitiesimport type { Disk } from '@/types/api';+import type { Resource } from '@/types/resource';type DiskInput = {device?: string;@@ -338,3 +339,33 @@ export function normalizeDiskArray(disks?: DiskInput[]): Disk[] | undefined {});return normalized.length > 0 ? normalized : undefined;}++export function getResourceDiskSummary(+ resource: Pick<Resource, 'agent' | 'disk'>,+): Disk | undefined {+ if (resource.disk) {+ const total = resource.disk.total ?? 0;+ const used = resource.disk.used ?? 0;+ return {+ total,+ used,+ free: resource.disk.free ?? Math.max(total - used, 0),+ usage: total > 0 ? (used / total) * 100 : resource.disk.current,+ };+ }++ const disks = normalizeDiskArray(resource.agent?.disks);+ if (!disks) return undefined;++ const total = disks.reduce((sum, disk) => sum + disk.total, 0);+ if (total <= 0) return undefined;+ const used = disks.reduce((sum, disk) => sum + disk.used, 0);+ const free = disks.reduce((sum, disk) => sum + disk.free, 0);++ return {+ total,+ used,+ free,+ usage: (used / total) * 100,+ };+}