mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-20 04:36:41 +00:00
Add more info to disk metrics
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user