Add a new metric smartctl_device_erc_seconds for reporting the device Error Recovery Control (TLER) setting.

This commit is contained in:
Octavian Cerna 2020-07-27 00:37:43 +03:00
parent 53399a5e73
commit 9e58dd6fd2
2 changed files with 28 additions and 0 deletions

View file

@ -224,4 +224,16 @@ var (
},
nil,
)
metricDeviceERCSeconds = prometheus.NewDesc(
"smartctl_device_erc_seconds",
"Device SMART Error Recovery Control Seconds",
[]string{
"device",
"model_family",
"model_name",
"serial_number",
"op_type",
},
nil,
)
)

View file

@ -54,6 +54,7 @@ func (smart *SMARTctl) Collect() {
smart.mineDeviceStatus()
smart.mineDeviceErrorLog()
smart.mineDeviceSelfTestLog()
smart.mineDeviceERC()
}
func (smart *SMARTctl) mineExitStatus() {
@ -354,3 +355,18 @@ func (smart *SMARTctl) mineDeviceSelfTestLog() {
)
}
}
func (smart *SMARTctl) mineDeviceERC() {
for ercType, status := range smart.json.Get("ata_sct_erc").Map() {
smart.ch <- prometheus.MustNewConstMetric(
metricDeviceERCSeconds,
prometheus.GaugeValue,
status.Get("deciseconds").Float()/10.0,
smart.device.device,
smart.device.family,
smart.device.model,
smart.device.serial,
ercType,
)
}
}