mirror of
https://github.com/prometheus-community/smartctl_exporter.git
synced 2024-11-23 01:43:07 +01:00
Critical metrics for SCSI disks added
Signed-off-by: Denys Lemeshko <denys.lemeshko@pm.bet>
This commit is contained in:
parent
895bf1eeb3
commit
637ad4223b
2 changed files with 114 additions and 1 deletions
55
metrics.go
55
metrics.go
|
@ -271,4 +271,59 @@ var (
|
||||||
},
|
},
|
||||||
nil,
|
nil,
|
||||||
)
|
)
|
||||||
|
metricSCSIGrownDefectList = prometheus.NewDesc(
|
||||||
|
"smartctl_scsi_grown_defect_list",
|
||||||
|
"Device SCSI grown defect list counter",
|
||||||
|
[]string{
|
||||||
|
"device",
|
||||||
|
"model_family",
|
||||||
|
"model_name",
|
||||||
|
"serial_number",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
metricReadErrorsCorrectedByRereadsRewrites = prometheus.NewDesc(
|
||||||
|
"smartctl_read_errors_corrected_by_rereads_rewrites",
|
||||||
|
"Read Errors Corrected by ReReads/ReWrites",
|
||||||
|
[]string{
|
||||||
|
"device",
|
||||||
|
"model_family",
|
||||||
|
"model_name",
|
||||||
|
"serial_number",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
metricReadTotalUncorrectedErrors = prometheus.NewDesc(
|
||||||
|
"smartctl_read_total_uncorrected_errors",
|
||||||
|
"Read Total Uncorrected Errors",
|
||||||
|
[]string{
|
||||||
|
"device",
|
||||||
|
"model_family",
|
||||||
|
"model_name",
|
||||||
|
"serial_number",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
metricWriteErrorsCorrectedByRereadsRewrites = prometheus.NewDesc(
|
||||||
|
"smartctl_write_errors_corrected_by_rereads_rewrites",
|
||||||
|
"Write Errors Corrected by ReReads/ReWrites",
|
||||||
|
[]string{
|
||||||
|
"device",
|
||||||
|
"model_family",
|
||||||
|
"model_name",
|
||||||
|
"serial_number",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
metricWriteTotalUncorrectedErrors = prometheus.NewDesc(
|
||||||
|
"smartctl_write_total_uncorrected_errors",
|
||||||
|
"Write Total Uncorrected Errors",
|
||||||
|
[]string{
|
||||||
|
"device",
|
||||||
|
"model_family",
|
||||||
|
"model_name",
|
||||||
|
"serial_number",
|
||||||
|
},
|
||||||
|
nil,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
60
smartctl.go
60
smartctl.go
|
@ -81,7 +81,8 @@ func (smart *SMARTctl) Collect() {
|
||||||
smart.mineBytesRead()
|
smart.mineBytesRead()
|
||||||
smart.mineBytesWritten()
|
smart.mineBytesWritten()
|
||||||
smart.mineSmartStatus()
|
smart.mineSmartStatus()
|
||||||
|
smart.mineSCSIGrownDefectList()
|
||||||
|
smart.mineSCSIErrorCounterLog()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (smart *SMARTctl) mineExitStatus() {
|
func (smart *SMARTctl) mineExitStatus() {
|
||||||
|
@ -435,3 +436,60 @@ func (smart *SMARTctl) mineDeviceERC() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (smart *SMARTctl) mineSCSIGrownDefectList() {
|
||||||
|
scsi_grown_defect_list := smart.json.Get("scsi_grown_defect_list")
|
||||||
|
if scsi_grown_defect_list.Exists() {
|
||||||
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
|
metricSCSIGrownDefectList,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
scsi_grown_defect_list.Float(),
|
||||||
|
smart.device.device,
|
||||||
|
smart.device.family,
|
||||||
|
smart.device.model,
|
||||||
|
smart.device.serial,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (smart *SMARTctl) mineSCSIErrorCounterLog() {
|
||||||
|
SCSIHealth := smart.json.Get("scsi_error_counter_log")
|
||||||
|
if SCSIHealth.Exists() {
|
||||||
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
|
metricReadErrorsCorrectedByRereadsRewrites,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
SCSIHealth.Get("read.errors_corrected_by_rereads_rewrites").Float(),
|
||||||
|
smart.device.device,
|
||||||
|
smart.device.family,
|
||||||
|
smart.device.model,
|
||||||
|
smart.device.serial,
|
||||||
|
)
|
||||||
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
|
metricReadTotalUncorrectedErrors,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
SCSIHealth.Get("read.total_uncorrected_errors").Float(),
|
||||||
|
smart.device.device,
|
||||||
|
smart.device.family,
|
||||||
|
smart.device.model,
|
||||||
|
smart.device.serial,
|
||||||
|
)
|
||||||
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
|
metricWriteErrorsCorrectedByRereadsRewrites,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
SCSIHealth.Get("write.errors_corrected_by_rereads_rewrites").Float(),
|
||||||
|
smart.device.device,
|
||||||
|
smart.device.family,
|
||||||
|
smart.device.model,
|
||||||
|
smart.device.serial,
|
||||||
|
)
|
||||||
|
smart.ch <- prometheus.MustNewConstMetric(
|
||||||
|
metricWriteTotalUncorrectedErrors,
|
||||||
|
prometheus.CounterValue,
|
||||||
|
SCSIHealth.Get("write.total_uncorrected_errors").Float(),
|
||||||
|
smart.device.device,
|
||||||
|
smart.device.family,
|
||||||
|
smart.device.model,
|
||||||
|
smart.device.serial,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue