From 857903be2bb9fc7d2e3068f16d5f4ae91b0ac041 Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Fri, 13 May 2022 13:31:22 +0200 Subject: [PATCH] Skip disks in DiskstatCollector that have size=0 --- collectors/diskstatMetric.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/collectors/diskstatMetric.go b/collectors/diskstatMetric.go index 4910c83..3e7af01 100644 --- a/collectors/diskstatMetric.go +++ b/collectors/diskstatMetric.go @@ -82,6 +82,9 @@ func (m *DiskstatCollector) Read(interval time.Duration, output chan lp.CCMetric if err != nil { continue } + if stat.Blocks == 0 || stat.Bsize == 0 { + continue + } tags := map[string]string{"type": "node", "device": linefields[0]} total := (stat.Blocks * uint64(stat.Bsize)) / uint64(1000000000) y, err := lp.New("disk_total", tags, m.meta, map[string]interface{}{"value": total}, time.Now())