Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ var (
},
nil,
)
metricSCSIUsedEnduranceIndicator = prometheus.NewDesc(
"smartctl_scsi_percentage_used_endurance_indicator",
"Device SCSI percentage used endurance indicator",
[]string{
"device",
},
nil,
)
metricReadErrorsCorrectedByRereadsRewrites = prometheus.NewDesc(
"smartctl_read_errors_corrected_by_rereads_rewrites",
"Read Errors Corrected by ReReads/ReWrites",
Expand Down Expand Up @@ -354,4 +362,36 @@ var (
},
nil,
)
metricVerifyErrorsCorrectedByRereadsRewrites = prometheus.NewDesc(
"smartctl_verify_errors_corrected_by_rereads_rewrites",
"Verify Errors Corrected by ReReads/ReWrites",
[]string{
"device",
},
nil,
)
metricVerifyErrorsCorrectedByEccFast = prometheus.NewDesc(
"smartctl_verify_errors_corrected_by_eccfast",
"Verify Errors Corrected by ECC Fast",
[]string{
"device",
},
nil,
)
metricVerifyErrorsCorrectedByEccDelayed = prometheus.NewDesc(
"smartctl_verify_errors_corrected_by_eccdelayed",
"Verify Errors Corrected by ECC Delayed",
[]string{
"device",
},
nil,
)
metricVerifyTotalUncorrectedErrors = prometheus.NewDesc(
"smartctl_verify_total_uncorrected_errors",
"Verify Total Uncorrected Errors",
[]string{
"device",
},
nil,
)
)
38 changes: 37 additions & 1 deletion smartctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (smart *SMARTctl) Collect() {
}
// SCSI, SAS
if smart.device.interface_ == "scsi" {
smart.mineSCSIUsedEnduranceIndicator()
smart.mineSCSIGrownDefectList()
smart.mineSCSIErrorCounterLog()
smart.mineSCSIBytesRead()
Expand Down Expand Up @@ -586,6 +587,18 @@ func (smart *SMARTctl) mineSCSIGrownDefectList() {
}
}

func (smart *SMARTctl) mineSCSIUsedEnduranceIndicator() {
scsi_percentage_used_endurance_indicator := smart.json.Get("scsi_percentage_used_endurance_indicator")
if scsi_percentage_used_endurance_indicator.Exists() {
smart.ch <- prometheus.MustNewConstMetric(
metricSCSIUsedEnduranceIndicator,
prometheus.GaugeValue,
scsi_percentage_used_endurance_indicator.Float(),
smart.device.device,
)
}
}

func (smart *SMARTctl) mineSCSIErrorCounterLog() {
SCSIHealth := smart.json.Get("scsi_error_counter_log")
if SCSIHealth.Exists() {
Expand Down Expand Up @@ -637,6 +650,29 @@ func (smart *SMARTctl) mineSCSIErrorCounterLog() {
SCSIHealth.Get("write.total_uncorrected_errors").Float(),
smart.device.device,
)
// TODO: Should we also export the verify category?
smart.ch <- prometheus.MustNewConstMetric(
metricVerifyErrorsCorrectedByRereadsRewrites,
prometheus.GaugeValue,
SCSIHealth.Get("verify.errors_corrected_by_rereads_rewrites").Float(),
smart.device.device,
)
smart.ch <- prometheus.MustNewConstMetric(
metricVerifyErrorsCorrectedByEccFast,
prometheus.GaugeValue,
SCSIHealth.Get("verify.errors_corrected_by_eccfast").Float(),
smart.device.device,
)
smart.ch <- prometheus.MustNewConstMetric(
metricVerifyErrorsCorrectedByEccDelayed,
prometheus.GaugeValue,
SCSIHealth.Get("verify.errors_corrected_by_eccdelayed").Float(),
smart.device.device,
)
smart.ch <- prometheus.MustNewConstMetric(
metricVerifyTotalUncorrectedErrors,
prometheus.GaugeValue,
SCSIHealth.Get("verify.total_uncorrected_errors").Float(),
smart.device.device,
)
}
}