mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-23 22:26:27 +00:00
Merge pull request #452 from vteratipally/add_fstypes
Add more info to disk metrics
This commit is contained in:
@@ -40,6 +40,7 @@ Below metrics are collected from `disk` component:
|
||||
* `disk_operation_bytes_count`: # of Bytes used for reads/writes on this device
|
||||
* `disk_operation_time`: [# of milliseconds spent reading/writing][iostat doc]
|
||||
* `disk_bytes_used`: Disk usage in Bytes. The usage state is reported under the `state` metric label (e.g. `used`, `free`). Summing values of all states yields the disk size.
|
||||
FSType and MountOptions are also reported as additional information.
|
||||
|
||||
The name of the disk block device is reported in the `device_name` metric label (e.g. `sda`).
|
||||
|
||||
|
||||
@@ -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