mirror of
https://github.com/prometheus-community/smartctl_exporter.git
synced 2024-11-16 01:33:07 +01:00
Add a new metric smartctl_device_erc_seconds for reporting the device Error Recovery Control (TLER) setting.
This commit is contained in:
parent
53399a5e73
commit
9e58dd6fd2
2 changed files with 28 additions and 0 deletions
12
metrics.go
12
metrics.go
|
@ -224,4 +224,16 @@ var (
|
||||||
},
|
},
|
||||||
nil,
|
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,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
16
smartctl.go
16
smartctl.go
|
@ -54,6 +54,7 @@ func (smart *SMARTctl) Collect() {
|
||||||
smart.mineDeviceStatus()
|
smart.mineDeviceStatus()
|
||||||
smart.mineDeviceErrorLog()
|
smart.mineDeviceErrorLog()
|
||||||
smart.mineDeviceSelfTestLog()
|
smart.mineDeviceSelfTestLog()
|
||||||
|
smart.mineDeviceERC()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineExitStatus() {
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue