avoid duplicating the disk bytes used metrics based on fstype and mountopts

This commit is contained in:
varsha teratipally
2020-11-16 20:10:46 +00:00
parent 35bfe697a5
commit 1550882948
+9
View File
@@ -269,7 +269,16 @@ func (dc *diskCollector) collect() {
if dc.mBytesUsed == nil {
return
}
// to make sure that the rows are not duplicated
// we display only the only one row even if there are
// mutiple rows for the same disk.
seen := make(map[string]bool)
for _, partition := range partitions {
if seen[partition.Device] {
continue
}
seen[partition.Device] = true
usageStat, err := disk.Usage(partition.Mountpoint)
if err != nil {
glog.Errorf("Failed to retrieve disk usage for %q: %v", partition.Mountpoint, err)