From 54d14519ca538870a275e408796b9abd0da847f1 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Wed, 4 May 2022 11:54:34 +0200 Subject: [PATCH] Skip mount points in DiskstatCollector if statfs() call does not work (bind mounts, ...) --- collectors/diskstatMetric.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/collectors/diskstatMetric.go b/collectors/diskstatMetric.go index 16c70ba..4910c83 100644 --- a/collectors/diskstatMetric.go +++ b/collectors/diskstatMetric.go @@ -3,7 +3,6 @@ package collectors import ( "bufio" "encoding/json" - "fmt" "os" "strings" "syscall" @@ -81,8 +80,7 @@ func (m *DiskstatCollector) Read(interval time.Duration, output chan lp.CCMetric stat := syscall.Statfs_t{} err := syscall.Statfs(path, &stat) if err != nil { - fmt.Println(err.Error()) - return + continue } tags := map[string]string{"type": "node", "device": linefields[0]} total := (stat.Blocks * uint64(stat.Bsize)) / uint64(1000000000)