Skip disks in DiskstatCollector that have size=0

This commit is contained in:
Thomas Roehl 2022-05-13 13:31:22 +02:00
parent 80d92d6d28
commit 857903be2b

View File

@ -82,6 +82,9 @@ func (m *DiskstatCollector) Read(interval time.Duration, output chan lp.CCMetric
if err != nil { if err != nil {
continue continue
} }
if stat.Blocks == 0 || stat.Bsize == 0 {
continue
}
tags := map[string]string{"type": "node", "device": linefields[0]} tags := map[string]string{"type": "node", "device": linefields[0]}
total := (stat.Blocks * uint64(stat.Bsize)) / uint64(1000000000) total := (stat.Blocks * uint64(stat.Bsize)) / uint64(1000000000)
y, err := lp.New("disk_total", tags, m.meta, map[string]interface{}{"value": total}, time.Now()) y, err := lp.New("disk_total", tags, m.meta, map[string]interface{}{"value": total}, time.Now())