Skip to content

Commit 3136901

Browse files
authored
Ignore filesystems flagged as MNT_IGNORE. (#2227)
* Ignore filesystems flagges as MNT_IGNORE. Closes #2152. Signed-off-by: Lapo Luchini <[email protected]>
1 parent 1d5afd0 commit 3136901

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

collector/filesystem_freebsd.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,16 @@ import (
2424
const (
2525
defMountPointsExcluded = "^/(dev)($|/)"
2626
defFSTypesExcluded = "^devfs$"
27-
readOnly = 0x1 // MNT_RDONLY
28-
noWait = 0x2 // MNT_NOWAIT
2927
)
3028

3129
// Expose filesystem fullness.
3230
func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
33-
n, err := unix.Getfsstat(nil, noWait)
31+
n, err := unix.Getfsstat(nil, unix.MNT_NOWAIT)
3432
if err != nil {
3533
return nil, err
3634
}
3735
buf := make([]unix.Statfs_t, n)
38-
_, err = unix.Getfsstat(buf, noWait)
36+
_, err = unix.Getfsstat(buf, unix.MNT_NOWAIT)
3937
if err != nil {
4038
return nil, err
4139
}
@@ -54,8 +52,13 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
5452
continue
5553
}
5654

55+
if (fs.Flags & unix.MNT_IGNORE) != 0 {
56+
level.Debug(c.logger).Log("msg", "Ignoring mount flagged as ignore", "mountpoint", mountpoint)
57+
continue
58+
}
59+
5760
var ro float64
58-
if (fs.Flags & readOnly) != 0 {
61+
if (fs.Flags & unix.MNT_RDONLY) != 0 {
5962
ro = 1
6063
}
6164

0 commit comments

Comments
 (0)