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
import { canonicalizeFrontendResourceType } from '@/utils/resourceTypeCompat';
import { asTrimmedString } from '@/utils/stringUtils';
type DiscoveryTargetLike = {
resourceType?: string;
resourceId?: string;
agentId?: string;
} | null;
const normalizeDiscoveryResourceType = (resourceType: unknown): string | undefined => {
return asTrimmedString(resourceType)?.toLowerCase();
};
export const canonicalDiscoveryResourceType = (resourceType: unknown): string | undefined => {
const normalized = normalizeDiscoveryResourceType(resourceType);
if (!normalized) return undefined;
return canonicalizeFrontendResourceType(normalized) || normalized;
};
export const toDiscoveryAPIResourceType = (resourceType: unknown): string | undefined => {
const canonical = canonicalDiscoveryResourceType(resourceType);
if (!canonical) return undefined;
if (canonical === 'pod') return 'k8s';
if (canonical === 'app-container') return 'docker';
return canonical;
};
export const isAgentDiscoveryResourceType = (resourceType: unknown): boolean => {
const normalized = normalizeDiscoveryResourceType(resourceType);
return normalized === 'agent';
};
export const isAppContainerDiscoveryResourceType = (resourceType: unknown): boolean => {
const normalized = normalizeDiscoveryResourceType(resourceType);
return normalized === 'app-container';
};
export const getAgentDiscoveryResourceId = (
discoveryTarget: DiscoveryTargetLike,
): string | undefined => {
if (!discoveryTarget || !isAgentDiscoveryResourceType(discoveryTarget.resourceType)) {
return undefined;
}
return asTrimmedString(discoveryTarget.resourceId) || asTrimmedString(discoveryTarget.agentId);
};