collector: sync bsd filesystem collector labels with linux
This commit is contained in:
parent
14078251c5
commit
ebf3ef32f1
|
@ -35,10 +35,6 @@ const (
|
||||||
defIgnoredMountPoints = "^/(dev)($|/)"
|
defIgnoredMountPoints = "^/(dev)($|/)"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
filesystemLabelNames = []string{"filesystem"}
|
|
||||||
)
|
|
||||||
|
|
||||||
// Expose filesystem fullness.
|
// Expose filesystem fullness.
|
||||||
func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
||||||
var mntbuf *C.struct_statfs
|
var mntbuf *C.struct_statfs
|
||||||
|
@ -50,13 +46,16 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
|
||||||
mnt := (*[1 << 30]C.struct_statfs)(unsafe.Pointer(mntbuf))
|
mnt := (*[1 << 30]C.struct_statfs)(unsafe.Pointer(mntbuf))
|
||||||
stats = []filesystemStats{}
|
stats = []filesystemStats{}
|
||||||
for i := 0; i < int(count); i++ {
|
for i := 0; i < int(count); i++ {
|
||||||
name := C.GoString(&mnt[i].f_mntonname[0])
|
mountpoint := C.GoString(&mnt[i].f_mntonname[0])
|
||||||
if c.ignoredMountPointsPattern.MatchString(name) {
|
if c.ignoredMountPointsPattern.MatchString(mountpoint) {
|
||||||
log.Debugf("Ignoring mount point: %s", name)
|
log.Debugf("Ignoring mount point: %s", mountpoint)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
labelValues := []string{name}
|
device := C.GoString(&mnt[i].f_mntfromname[0])
|
||||||
|
fstype := C.GoString(&mnt[i].f_fstypename[0])
|
||||||
|
|
||||||
|
labelValues := []string{device, mountpoint, fstype}
|
||||||
stats = append(stats, filesystemStats{
|
stats = append(stats, filesystemStats{
|
||||||
labelValues: labelValues,
|
labelValues: labelValues,
|
||||||
size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize),
|
size: float64(mnt[i].f_blocks) * float64(mnt[i].f_bsize),
|
||||||
|
|
|
@ -33,6 +33,8 @@ var (
|
||||||
"collector.filesystem.ignored-mount-points",
|
"collector.filesystem.ignored-mount-points",
|
||||||
defIgnoredMountPoints,
|
defIgnoredMountPoints,
|
||||||
"Regexp of mount points to ignore for filesystem collector.")
|
"Regexp of mount points to ignore for filesystem collector.")
|
||||||
|
|
||||||
|
filesystemLabelNames = []string{"device", "mountpoint", "fstype"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type filesystemCollector struct {
|
type filesystemCollector struct {
|
||||||
|
|
|
@ -28,10 +28,6 @@ const (
|
||||||
defIgnoredMountPoints = "^/(sys|proc|dev)($|/)"
|
defIgnoredMountPoints = "^/(sys|proc|dev)($|/)"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
filesystemLabelNames = []string{"device", "mountpoint", "fstype"}
|
|
||||||
)
|
|
||||||
|
|
||||||
type filesystemDetails struct {
|
type filesystemDetails struct {
|
||||||
device string
|
device string
|
||||||
mountPoint string
|
mountPoint string
|
||||||
|
|
Loading…
Reference in New Issue