Add more info to disk metrics

This commit is contained in:
varsha teratipally
2020-08-05 21:12:25 +00:00
parent c01ea4f582
commit e13210157d
2 changed files with 11 additions and 3 deletions
+5 -3
View File
@@ -145,7 +145,7 @@ func NewDiskCollectorOrDie(diskConfig *ssmtypes.DiskStatsConfig) *diskCollector
"Disk bytes used, in Bytes",
"Byte",
metrics.LastValue,
[]string{deviceNameLabel, stateLabel})
[]string{deviceNameLabel, fstypeLabel, mountOptionLabel, stateLabel})
if err != nil {
glog.Fatalf("Error initializing metric for %q: %v", metrics.DiskBytesUsedID, err)
}
@@ -276,8 +276,10 @@ func (dc *diskCollector) collect() {
continue
}
deviceName := strings.TrimPrefix(partition.Device, "/dev/")
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "free"}, int64(usageStat.Free))
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, stateLabel: "used"}, int64(usageStat.Used))
fstype := partition.Fstype
opttypes := partition.Opts
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fstypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "free"}, int64(usageStat.Free))
dc.mBytesUsed.Record(map[string]string{deviceNameLabel: deviceName, fstypeLabel: fstype, mountOptionLabel: opttypes, stateLabel: "used"}, int64(usageStat.Used))
}
}
+6
View File
@@ -24,3 +24,9 @@ const directionLabel = "direction"
// stateLabel labels the state of disk/memory/cpu usage, e.g.: "free", "used".
const stateLabel = "state"
// fstypeLabel labels the fst type of the disk, e.g.: "ext4", "ext2", "vfat"
const fstypeLabel = "fstype"
// mountPointLabel labels the mountpoint of the monitored disk device
const mountOptionLabel = "mountoption"