Skip to content

Commit 86101b9

Browse files
committed
fix: fix no disk info on apfs file system
fix double counting size with subvolume See: cokemine/nodestatus-client-go#18 (comment)
1 parent 33c2264 commit 86101b9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pkg/status/status.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ func Disk(INTERVAL *float64) (uint64, uint64) {
4646
)
4747
if timer <= 0 {
4848
diskList, _ := disk.Partitions(false)
49+
devices := make(map[string]bool)
4950
for _, d := range diskList {
5051
if checkValidFs(d.Fstype) {
52+
if devices[d.Device] {
53+
continue
54+
}
5155
cachedFs[d.Mountpoint] = struct{}{}
56+
devices[d.Device] = true
5257
}
5358
}
54-
timer = 150.0
59+
timer = 300.0
5560
}
5661
timer -= *INTERVAL
5762
for k := range cachedFs {

pkg/status/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
)
77

88
var invalidInterface = []string{"lo", "tun", "kube", "docker", "vmbr", "br-", "vnet", "veth"}
9-
var validFs = []string{"ext4", "ext3", "ext2", "reiserfs", "jfs", "btrfs", "fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs"}
9+
var validFs = []string{"ext4", "ext3", "ext2", "reiserfs", "jfs", "btrfs", "fuseblk", "zfs", "simfs", "ntfs", "fat32", "exfat", "xfs", "apfs"}
1010

1111
func BytesToString(b []byte) string {
1212
return *(*string)(unsafe.Pointer(&b))

0 commit comments

Comments
 (0)