Fix filesystem collector for OpenBSD to not print loads of zero bytes in name (#2637)

Use the filesystem collector for all OpenBSD archs, there is no reason to
only use it on amd64 systems.

Signed-off-by: Claudio Jeker <claudio@openbsd.org>
pull/2688/head
Claudio Jeker 2023-05-11 10:40:38 +02:00 committed by GitHub
parent 6251cc7b6c
commit 184a4e0893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
//go:build ((openbsd && !amd64) || darwin || dragonfly) && !nofilesystem //go:build (darwin || dragonfly) && !nofilesystem
// +build openbsd,!amd64 darwin dragonfly // +build darwin dragonfly
// +build !nofilesystem // +build !nofilesystem
package collector package collector

View File

@ -41,14 +41,14 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
stats = []filesystemStats{} stats = []filesystemStats{}
for _, v := range mnt { for _, v := range mnt {
mountpoint := string(v.F_mntonname[:]) mountpoint := unix.ByteSliceToString(v.F_mntonname[:])
if c.excludedMountPointsPattern.MatchString(mountpoint) { if c.excludedMountPointsPattern.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 := string(v.F_mntfromname[:]) device := unix.ByteSliceToString(v.F_mntfromname[:])
fstype := string(v.F_fstypename[:]) fstype := unix.ByteSliceToString(v.F_fstypename[:])
if c.excludedFSTypesPattern.MatchString(fstype) { if c.excludedFSTypesPattern.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