mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Fix btrfs device stats always being zero (#2516)
* Respect rootfs path config option in btrfs ioctl * Fix btrfs device stats always being zero Signed-off-by: Marcus Cobden <leth@users.noreply.github.com>
This commit is contained in:
parent
fd14fb04c7
commit
936368d217
|
@ -123,13 +123,15 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fs, err := dennwc.Open(mount.mountPoint, true)
|
mountPath := rootfsFilePath(mount.mountPoint)
|
||||||
|
|
||||||
|
fs, err := dennwc.Open(mountPath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to open this mount point, maybe we didn't have permission
|
// Failed to open this mount point, maybe we didn't have permission
|
||||||
// maybe we'll find another mount point for this FS later.
|
// maybe we'll find another mount point for this FS later.
|
||||||
level.Debug(c.logger).Log(
|
level.Debug(c.logger).Log(
|
||||||
"msg", "Error inspecting btrfs mountpoint",
|
"msg", "Error inspecting btrfs mountpoint",
|
||||||
"mountPoint", mount.mountPoint,
|
"mountPoint", mountPath,
|
||||||
"err", err)
|
"err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -140,7 +142,7 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
|
||||||
// perhaps it'll work with a different mount point
|
// perhaps it'll work with a different mount point
|
||||||
level.Debug(c.logger).Log(
|
level.Debug(c.logger).Log(
|
||||||
"msg", "Error querying btrfs filesystem",
|
"msg", "Error querying btrfs filesystem",
|
||||||
"mountPoint", mount.mountPoint,
|
"mountPoint", mountPath,
|
||||||
"err", err)
|
"err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -155,7 +157,7 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Debug(c.logger).Log(
|
level.Debug(c.logger).Log(
|
||||||
"msg", "Error querying btrfs device stats",
|
"msg", "Error querying btrfs device stats",
|
||||||
"mountPoint", mount.mountPoint,
|
"mountPoint", mountPath,
|
||||||
"err", err)
|
"err", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -5,7 +5,7 @@ go 1.17
|
||||||
require (
|
require (
|
||||||
github.com/beevik/ntp v0.3.0
|
github.com/beevik/ntp v0.3.0
|
||||||
github.com/coreos/go-systemd/v22 v22.4.0
|
github.com/coreos/go-systemd/v22 v22.4.0
|
||||||
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac
|
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072
|
||||||
github.com/ema/qdisc v0.0.0-20200603082823-62d0308e3e00
|
github.com/ema/qdisc v0.0.0-20200603082823-62d0308e3e00
|
||||||
github.com/go-kit/log v0.2.1
|
github.com/go-kit/log v0.2.1
|
||||||
github.com/godbus/dbus/v5 v5.1.0
|
github.com/godbus/dbus/v5 v5.1.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -99,8 +99,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac h1:cjfIEKdg/lZ+ewJk8FYoYZTN2HY/okVSPtmHLaYMAvE=
|
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072 h1:7jWBDCngQSBfRmrRCpYH3iPPVOe5i8xbl+5rQHkwZDE=
|
||||||
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac/go.mod h1:MYsOV9Dgsec3FFSOjywi0QK5r6TeBbdWxdrMGtiYXHA=
|
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072/go.mod h1:MYsOV9Dgsec3FFSOjywi0QK5r6TeBbdWxdrMGtiYXHA=
|
||||||
github.com/dennwc/ioctl v1.0.0 h1:DsWAAjIxRqNcLn9x6mwfuf2pet3iB7aK90K4tF16rLg=
|
github.com/dennwc/ioctl v1.0.0 h1:DsWAAjIxRqNcLn9x6mwfuf2pet3iB7aK90K4tF16rLg=
|
||||||
github.com/dennwc/ioctl v1.0.0/go.mod h1:ellh2YB5ldny99SBU/VX7Nq0xiZbHphf1DrtHxxjMk0=
|
github.com/dennwc/ioctl v1.0.0/go.mod h1:ellh2YB5ldny99SBU/VX7Nq0xiZbHphf1DrtHxxjMk0=
|
||||||
github.com/ema/qdisc v0.0.0-20200603082823-62d0308e3e00 h1:0GHzegkDz/zSrt+Zph1OueNImPdUxoToypnkhhRYTjI=
|
github.com/ema/qdisc v0.0.0-20200603082823-62d0308e3e00 h1:0GHzegkDz/zSrt+Zph1OueNImPdUxoToypnkhhRYTjI=
|
||||||
|
|
Loading…
Reference in a new issue