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: disk-exclude now works with device paths and disk I/O
rcourtman61bb582d82b1
diff --git a/internal/hostmetrics/collector.go b/internal/hostmetrics/collector.goindex bfb9e9415c..1f066cecb2 100644--- a/internal/hostmetrics/collector.go+++ b/internal/hostmetrics/collector.go@@ -80,7 +80,7 @@ func Collect(ctx context.Context, diskExclude []string) (Snapshot, error) {}snapshot.Disks = collectDisks(collectCtx, diskExclude)- snapshot.DiskIO = collectDiskIO(collectCtx)+ snapshot.DiskIO = collectDiskIO(collectCtx, diskExclude)snapshot.Network = collectNetwork(collectCtx)return snapshot, nil@@ -129,8 +129,9 @@ func collectDisks(ctx context.Context, diskExclude []string) []agentshost.Disk {}seen[part.Mountpoint] = struct{}{}- // Check user-defined exclusions first (issue #896)- if fsfilters.MatchesUserExclude(part.Mountpoint, diskExclude) {+ // Check user-defined exclusions first (issue #896, #1142)+ // Check both device path and mountpoint to support patterns like "/dev/sda" or "/mnt/backup"+ if fsfilters.MatchesDiskExclude(part.Device, part.Mountpoint, diskExclude) {continue}@@ -271,7 +272,8 @@ func isLoopback(flags []string) bool {// collectDiskIO gathers I/O statistics for physical block devices.// Only reports whole disks (nvme0n1, sda), not partitions (nvme0n1p1, sda1).-func collectDiskIO(ctx context.Context) []agentshost.DiskIO {+// Respects user-defined disk exclusions to avoid reporting excluded devices.+func collectDiskIO(ctx context.Context, diskExclude []string) []agentshost.DiskIO {counters, err := diskIOCounters(ctx)if err != nil {return nil@@ -291,6 +293,10 @@ func collectDiskIO(ctx context.Context) []agentshost.DiskIO {if strings.HasPrefix(name, "dm-") {continue}+ // Skip user-excluded devices (issue #1142)+ if fsfilters.MatchesDeviceExclude(name, diskExclude) {+ continue+ }devices = append(devices, agentshost.DiskIO{Device: name,diff --git a/pkg/fsfilters/filters.go b/pkg/fsfilters/filters.goindex 08b520e646..f488abc867 100644--- a/pkg/fsfilters/filters.go+++ b/pkg/fsfilters/filters.go@@ -193,6 +193,74 @@ func ShouldSkipFilesystem(fsType, mountpoint string, totalBytes, usedBytes uint6// - Prefix patterns (ending with *): "/mnt/ext*" matches "/mnt/external", "/mnt/ext-drive"// - Contains patterns (surrounded by *): "*pbs*" matches any path containing "pbs"func MatchesUserExclude(mountpoint string, excludePatterns []string) bool {+ return matchesPattern(mountpoint, excludePatterns)+}++// MatchesDiskExclude checks if a disk (device or mountpoint) matches any exclusion pattern.+// This checks both the device path (e.g., /dev/sda) and the mountpoint (e.g., /mnt/backup)+// to allow users to exclude disks by either identifier.+func MatchesDiskExclude(device, mountpoint string, excludePatterns []string) bool {+ if len(excludePatterns) == 0 {+ return false+ }++ // Check against mountpoint+ if mountpoint != "" && matchesPattern(mountpoint, excludePatterns) {+ return true+ }++ // Check against device path+ if device != "" && matchesPattern(device, excludePatterns) {+ return true+ }++ // Check against device name (without /dev/ prefix)+ if device != "" {+ deviceName := device+ if strings.HasPrefix(device, "/dev/") {+ deviceName = device[5:]+ }+ if matchesPattern(deviceName, excludePatterns) {+ return true+ }+ }++ return false+}++// MatchesDeviceExclude checks if a device name/path matches exclusion patterns.+// For disk I/O collection where we only have device names (not mountpoints).+func MatchesDeviceExclude(device string, excludePatterns []string) bool {+ if len(excludePatterns) == 0 {+ return false+ }++ // Check against full device path+ if matchesPattern(device, excludePatterns) {+ return true+ }++ // Check with /dev/ prefix if not present+ if !strings.HasPrefix(device, "/dev/") {+ if matchesPattern("/dev/"+device, excludePatterns) {+ return true+ }+ }++ // Check device name without /dev/ prefix+ deviceName := device+ if strings.HasPrefix(device, "/dev/") {+ deviceName = device[5:]+ }+ if matchesPattern(deviceName, excludePatterns) {+ return true+ }++ return false+}++// matchesPattern checks if a value matches any of the exclusion patterns.+func matchesPattern(value string, excludePatterns []string) bool {if len(excludePatterns) == 0 {return false}@@ -206,7 +274,7 @@ func MatchesUserExclude(mountpoint string, excludePatterns []string) bool {// Contains pattern: *substring*if strings.HasPrefix(pattern, "*") && strings.HasSuffix(pattern, "*") && len(pattern) > 2 {substring := pattern[1 : len(pattern)-1]- if strings.Contains(mountpoint, substring) {+ if strings.Contains(value, substring) {return true}continue@@ -215,14 +283,14 @@ func MatchesUserExclude(mountpoint string, excludePatterns []string) bool {// Prefix pattern: /path/prefix*if strings.HasSuffix(pattern, "*") {prefix := pattern[:len(pattern)-1]- if strings.HasPrefix(mountpoint, prefix) {+ if strings.HasPrefix(value, prefix) {return true}continue}// Exact match- if mountpoint == pattern {+ if value == pattern {return true}}