aboutsummaryrefslogtreecommitdiff
path: root/collector/filesystem_freebsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'collector/filesystem_freebsd.go')
-rw-r--r--collector/filesystem_freebsd.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/collector/filesystem_freebsd.go b/collector/filesystem_freebsd.go
index 8bc8314..1d377b1 100644
--- a/collector/filesystem_freebsd.go
+++ b/collector/filesystem_freebsd.go
@@ -16,8 +16,6 @@
16package collector 16package collector
17 17
18import ( 18import (
19 "bytes"
20
21 "github.com/go-kit/kit/log/level" 19 "github.com/go-kit/kit/log/level"
22 "golang.org/x/sys/unix" 20 "golang.org/x/sys/unix"
23) 21)
@@ -42,19 +40,14 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
42 } 40 }
43 stats := []filesystemStats{} 41 stats := []filesystemStats{}
44 for _, fs := range buf { 42 for _, fs := range buf {
45 // We need to work out the lengths of the actual strings here, 43 mountpoint := bytesToString(fs.Mntonname[:])
46 // otherwuse we will end up with null bytes in our label values.
47 mountpoint_len := bytes.Index(fs.Mntonname[:], []byte{0})
48 mountpoint := string(fs.Mntonname[:mountpoint_len])
49 if c.ignoredMountPointsPattern.MatchString(mountpoint) { 44 if c.ignoredMountPointsPattern.MatchString(mountpoint) {
50 level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint) 45 level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint)
51 continue 46 continue
52 } 47 }
53 48
54 device_len := bytes.Index(fs.Mntfromname[:], []byte{0}) 49 device := bytesToString(fs.Mntfromname[:])
55 fstype_len := bytes.Index(fs.Fstypename[:], []byte{0}) 50 fstype := bytesToString(fs.Fstypename[:])
56 device := string(fs.Mntfromname[:device_len])
57 fstype := string(fs.Fstypename[:fstype_len])
58 if c.ignoredFSTypesPattern.MatchString(fstype) { 51 if c.ignoredFSTypesPattern.MatchString(fstype) {
59 level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype) 52 level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype)
60 continue 53 continue