|
|
@ -16,8 +16,6 @@ |
|
|
|
package collector |
|
|
|
package collector |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/go-kit/kit/log/level" |
|
|
|
"github.com/go-kit/kit/log/level" |
|
|
|
"golang.org/x/sys/unix" |
|
|
|
"golang.org/x/sys/unix" |
|
|
|
) |
|
|
|
) |
|
|
@ -42,19 +40,14 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
stats := []filesystemStats{} |
|
|
|
stats := []filesystemStats{} |
|
|
|
for _, fs := range buf { |
|
|
|
for _, fs := range buf { |
|
|
|
// We need to work out the lengths of the actual strings here,
|
|
|
|
mountpoint := bytesToString(fs.Mntonname[:]) |
|
|
|
// otherwuse we will end up with null bytes in our label values.
|
|
|
|
|
|
|
|
mountpoint_len := bytes.Index(fs.Mntonname[:], []byte{0}) |
|
|
|
|
|
|
|
mountpoint := string(fs.Mntonname[:mountpoint_len]) |
|
|
|
|
|
|
|
if c.ignoredMountPointsPattern.MatchString(mountpoint) { |
|
|
|
if c.ignoredMountPointsPattern.MatchString(mountpoint) { |
|
|
|
level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint) |
|
|
|
level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint) |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
device_len := bytes.Index(fs.Mntfromname[:], []byte{0}) |
|
|
|
device := bytesToString(fs.Mntfromname[:]) |
|
|
|
fstype_len := bytes.Index(fs.Fstypename[:], []byte{0}) |
|
|
|
fstype := bytesToString(fs.Fstypename[:]) |
|
|
|
device := string(fs.Mntfromname[:device_len]) |
|
|
|
|
|
|
|
fstype := string(fs.Fstypename[:fstype_len]) |
|
|
|
|
|
|
|
if c.ignoredFSTypesPattern.MatchString(fstype) { |
|
|
|
if c.ignoredFSTypesPattern.MatchString(fstype) { |
|
|
|
level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype) |
|
|
|
level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype) |
|
|
|
continue |
|
|
|
continue |
|
|
|