Skip to content

Commit

Permalink
Merge pull request #517 from mackerelio/fix-darwin-vm-volume
Browse files Browse the repository at this point in the history
[darwin] fix filesystem metrics for APFS vm partition volume
  • Loading branch information
itchyny committed Aug 30, 2018
2 parents 6d24cc9 + 4b929ce commit 80885e9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions util/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,20 @@ func parseDfLines(out string) []*DfStat {
continue
}

if runtime.GOOS == "darwin" && strings.HasPrefix(dfstat.Mounted, "/Volumes/") {
continue
if runtime.GOOS == "darwin" {
if strings.HasPrefix(dfstat.Mounted, "/Volumes/") {
continue
}
// Skip APFS vm partition, add its usage to the root filesystem.
if dfstat.Mounted == "/private/var/vm" {
for _, fs := range filesystems {
if fs.Mounted == "/" {
fs.Used += dfstat.Used
break
}
}
continue
}
}

filesystems = append(filesystems, dfstat)
Expand Down

0 comments on commit 80885e9

Please sign in to comment.