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.

Allow local mergerfs mounts in disk metrics

rcourtman7e5971a3ee47
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index 5a9d842bf7..26c8a065fe 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -803,6 +803,75 @@ func TestApplyHostReportFiltersVendorManagedSystemRAIDArrays(t *testing.T) {
}
}
+func TestApplyHostReportKeepsLocalMergerFSMounts(t *testing.T) {
+ t.Helper()
+
+ monitor := &Monitor{
+ state: models.NewState(),
+ alertManager: alerts.NewManager(),
+ hostTokenBindings: make(map[string]string),
+ config: &config.Config{},
+ rateTracker: NewRateTracker(),
+ }
+ t.Cleanup(func() { monitor.alertManager.Stop() })
+
+ report := agentshost.Report{
+ Agent: agentshost.AgentInfo{
+ ID: "agent-mergerfs-host",
+ Version: "1.0.0",
+ IntervalSeconds: 30,
+ },
+ Host: agentshost.HostInfo{
+ ID: "machine-mergerfs-host",
+ Hostname: "mergerfs-host",
+ MachineID: "machine-mergerfs-host",
+ },
+ Disks: []agentshost.Disk{
+ {
+ Device: "mergerfs",
+ Mountpoint: "/mnt/storage",
+ Type: "fuse.mergerfs",
+ TotalBytes: 10_000,
+ UsedBytes: 4_000,
+ FreeBytes: 6_000,
+ Usage: 40,
+ },
+ {
+ Device: "sshfs",
+ Mountpoint: "/mnt/remote",
+ Type: "fuse.sshfs",
+ TotalBytes: 10_000,
+ UsedBytes: 4_000,
+ FreeBytes: 6_000,
+ Usage: 40,
+ },
+ },
+ }
+
+ host, err := monitor.ApplyHostReport(report, nil)
+ if err != nil {
+ t.Fatalf("ApplyHostReport: %v", err)
+ }
+
+ if len(host.Disks) != 1 {
+ t.Fatalf("host disk count = %d, want 1 (%+v)", len(host.Disks), host.Disks)
+ }
+ if host.Disks[0].Type != "fuse.mergerfs" || host.Disks[0].Mountpoint != "/mnt/storage" {
+ t.Fatalf("unexpected retained disk %+v", host.Disks[0])
+ }
+
+ snapshot := monitor.state.GetSnapshot()
+ if len(snapshot.Hosts) != 1 {
+ t.Fatalf("snapshot host count = %d, want 1", len(snapshot.Hosts))
+ }
+ if len(snapshot.Hosts[0].Disks) != 1 {
+ t.Fatalf("stored host disk count = %d, want 1 (%+v)", len(snapshot.Hosts[0].Disks), snapshot.Hosts[0].Disks)
+ }
+ if snapshot.Hosts[0].Disks[0].Type != "fuse.mergerfs" || snapshot.Hosts[0].Disks[0].Mountpoint != "/mnt/storage" {
+ t.Fatalf("unexpected stored retained disk %+v", snapshot.Hosts[0].Disks[0])
+ }
+}
+
func TestApplyHostReportPersistsSMARTMetricsForAgentDisks(t *testing.T) {
t.Helper()
diff --git a/pkg/fsfilters/filters.go b/pkg/fsfilters/filters.go
index cc22f6afee..a1ffc0f5ff 100644
--- a/pkg/fsfilters/filters.go
+++ b/pkg/fsfilters/filters.go
@@ -84,7 +84,10 @@ var virtualFSTypes = map[string]bool{
}
// networkFSPatterns are substrings that indicate network/remote filesystems.
-var networkFSPatterns = []string{"fuse", "9p", "nfs", "cifs", "smb"}
+// Do not treat generic "fuse" as remote: some FUSE filesystems such as
+// mergerfs are local user-space filesystems and should participate in host
+// disk usage and alerting just like ext4/xfs mounts.
+var networkFSPatterns = []string{"sshfs", "9p", "nfs", "cifs", "smb"}
// specialMountPrefixes are mountpoint prefixes that indicate system mounts.
var specialMountPrefixes = []string{
diff --git a/pkg/fsfilters/filters_test.go b/pkg/fsfilters/filters_test.go
index bf0f6e6875..e975e67851 100644
--- a/pkg/fsfilters/filters_test.go
+++ b/pkg/fsfilters/filters_test.go
@@ -165,6 +165,7 @@ func TestShouldSkipFilesystem(t *testing.T) {
{"cifs mount", "cifs", "/mnt/share", 1000000, 500000, true},
{"fuse.sshfs", "fuse.sshfs", "/mnt/remote", 1000000, 500000, true},
{"9p VM shared folder", "9p", "/mnt/host", 1000000, 500000, true},
+ {"fuse.mergerfs local pool", "fuse.mergerfs", "/mnt/storage", 1000000, 500000, false},
// Special mountpoint prefixes
{"/dev prefix", "ext4", "/dev/shm", 1024, 100, true},