Drive tile counts each source device once (a bind mount doubled nexus's NVMe)

fs.* sensors carry a source label; Top.tsx dedupes by it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-11-11 00:06:33 -08:00
co-authored by Claude Opus 5.5
parent 574d9855ce
commit a6d7ff436f
5 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -102,6 +102,9 @@ type FS struct {
// said honestly: a ZFS pool or an md array spreads a filesystem over several drives, and
// a remote mount is on none of them.
Disk string `json:"disk,omitempty"`
// Source is the device the mount is of ("/dev/nvme0n1p1"). A bind mount has the same
// source as the filesystem it shows, so a sum over a drive counts each source once.
Source string `json:"source,omitempty"`
}
type UPS struct {
@@ -863,7 +866,7 @@ func filesystems() []FS {
return
}
bs := uint64(st.Bsize)
done <- FS{Mount: mount, Type: fs[2], Size: st.Blocks * bs, Used: (st.Blocks - st.Bfree) * bs, Remote: remoteFS[fs[2]], Disk: diskOf(fs[0])}
done <- FS{Mount: mount, Type: fs[2], Size: st.Blocks * bs, Used: (st.Blocks - st.Bfree) * bs, Remote: remoteFS[fs[2]], Disk: diskOf(fs[0]), Source: fs[0]}
}()
select {
case r := <-done:
+3
View File
@@ -137,6 +137,9 @@ func flatten(s Sample, want func(id string) bool) []sensors.Sensor {
if x.Disk != "" {
lbl = append(lbl, "disk", x.Disk)
}
if x.Source != "" {
lbl = append(lbl, "source", x.Source)
}
f.add(p+".size", x.Mount+" size", "bytes", "B", float64(x.Size), s.fsT, none, lbl...)
f.add(p+".used", x.Mount+" used", "bytes", "B", float64(x.Used), s.fsT, upTo(float64(x.Size)), lbl...)
f.add(p+".used_pct", x.Mount+" used", "usage", "%", ratio(x.Used, x.Size), s.fsT, pct, lbl...)