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_error_log_count for the SMART error log counts.
This commit is contained in:
parent
e8d95208d7
commit
3e17706839
2 changed files with 28 additions and 0 deletions
12
metrics.go
12
metrics.go
|
@ -188,4 +188,16 @@ var (
|
|||
},
|
||||
nil,
|
||||
)
|
||||
metricDeviceErrorLogCount = prometheus.NewDesc(
|
||||
"smartctl_device_error_log_count",
|
||||
"Device SMART error log count",
|
||||
[]string{
|
||||
"device",
|
||||
"model_family",
|
||||
"model_name",
|
||||
"serial_number",
|
||||
"error_log_type",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
)
|
||||
|
|
16
smartctl.go
16
smartctl.go
|
@ -52,6 +52,7 @@ func (smart *SMARTctl) Collect() {
|
|||
smart.mineDeviceSCTStatus()
|
||||
smart.mineDeviceStatistics()
|
||||
smart.mineDeviceStatus()
|
||||
smart.mineDeviceErrorLog()
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineExitStatus() {
|
||||
|
@ -312,3 +313,18 @@ func (smart *SMARTctl) mineDeviceStatus() {
|
|||
smart.device.serial,
|
||||
)
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineDeviceErrorLog() {
|
||||
for logType, status := range smart.json.Get("ata_smart_error_log").Map() {
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricDeviceErrorLogCount,
|
||||
prometheus.GaugeValue,
|
||||
status.Get("count").Float(),
|
||||
smart.device.device,
|
||||
smart.device.family,
|
||||
smart.device.model,
|
||||
smart.device.serial,
|
||||
logType,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue