The disks box is this machine's own storage, not a network share
core mounts grid's tank over CIFS, and it was listed beside root and efi as though it were a disk in the box. Filesystems whose storage is on another machine are now marked remote — a label on the fs sensors, so the sensor stays for anyone who wants it — and the Processes tab's disks box leaves them out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9bf60deffc
commit
bf0bdd54af
@@ -90,6 +90,10 @@ type FS struct {
|
||||
Type string `json:"type"`
|
||||
Size uint64 `json:"size"`
|
||||
Used uint64 `json:"used"`
|
||||
// Remote is set when the filesystem lives on another machine — a CIFS or NFS share,
|
||||
// sshfs, and so on. Its bytes are somebody else's disk, so a panel about this machine's
|
||||
// hardware leaves it out, while the sensor stays for anyone who does want it.
|
||||
Remote bool `json:"remote,omitempty"`
|
||||
}
|
||||
|
||||
type UPS struct {
|
||||
@@ -766,6 +770,15 @@ func foldNVMe(devs []Disk) []Disk {
|
||||
|
||||
// Kernel/virtual filesystems that aren't storage. Anything else that's mounted is
|
||||
// shown, so new real filesystems (bcachefs, exotic FUSE) work without a code change.
|
||||
// remoteFS is every filesystem type whose storage is not in this machine.
|
||||
var remoteFS = map[string]bool{
|
||||
"cifs": true, "smb3": true, "smbfs": true, "nfs": true, "nfs4": true, "afs": true,
|
||||
"ceph": true, "glusterfs": true, "9p": true, "afpfs": true, "davfs": true,
|
||||
"fuse.sshfs": true, "sshfs": true, "fuse.rclone": true, "fuse.s3fs": true,
|
||||
"fuse.davfs2": true, "fuse.curlftpfs": true, "fuse.gcsfuse": true, "beegfs": true,
|
||||
"lustre": true, "orangefs": true, "pvfs2": true, "coda": true, "ncpfs": true,
|
||||
}
|
||||
|
||||
var pseudoFS = map[string]bool{
|
||||
"proc": true, "sysfs": true, "devtmpfs": true, "devpts": true, "tmpfs": true, "ramfs": true,
|
||||
"cgroup": true, "cgroup2": true, "pstore": true, "bpf": true, "securityfs": true, "debugfs": true,
|
||||
@@ -812,7 +825,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}
|
||||
done <- FS{Mount: mount, Type: fs[2], Size: st.Blocks * bs, Used: (st.Blocks - st.Bfree) * bs, Remote: remoteFS[fs[2]]}
|
||||
}()
|
||||
select {
|
||||
case r := <-done:
|
||||
@@ -820,7 +833,7 @@ func filesystems() []FS {
|
||||
out = append(out, r)
|
||||
}
|
||||
case <-time.After(3 * time.Second):
|
||||
out = append(out, FS{Mount: mount, Type: fs[2]}) // unreachable: size 0 signals it
|
||||
out = append(out, FS{Mount: mount, Type: fs[2], Remote: remoteFS[fs[2]]}) // unreachable: size 0 signals it
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -117,9 +117,15 @@ func flatten(s Sample, want func(id string) bool) []sensors.Sensor {
|
||||
|
||||
for _, x := range s.FS {
|
||||
p := "fs." + sensors.Seg(x.Mount)
|
||||
f.add(p+".size", x.Mount+" size", "bytes", "B", float64(x.Size), s.fsT, none, "mount", x.Mount, "fstype", x.Type)
|
||||
f.add(p+".used", x.Mount+" used", "bytes", "B", float64(x.Used), s.fsT, upTo(float64(x.Size)), "mount", x.Mount, "fstype", x.Type)
|
||||
f.add(p+".used_pct", x.Mount+" used", "usage", "%", ratio(x.Used, x.Size), s.fsT, pct, "mount", x.Mount, "fstype", x.Type)
|
||||
// remote says the bytes are on another machine (a CIFS or NFS share), so a view of
|
||||
// this machine's hardware can leave it out without losing the sensor
|
||||
lbl := []string{"mount", x.Mount, "fstype", x.Type}
|
||||
if x.Remote {
|
||||
lbl = append(lbl, "remote", "1")
|
||||
}
|
||||
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...)
|
||||
}
|
||||
|
||||
if u := s.UPS; u != nil {
|
||||
|
||||
Reference in New Issue
Block a user