mirror of
https://github.com/prometheus-community/smartctl_exporter.git
synced 2024-11-16 01:33:07 +01:00
commit
ed7dbafd00
2 changed files with 0 additions and 90 deletions
44
metrics.go
44
metrics.go
|
@ -289,17 +289,6 @@ var (
|
|||
},
|
||||
nil,
|
||||
)
|
||||
metricCriticalWarning = prometheus.NewDesc(
|
||||
"critical_warning",
|
||||
"Critical warning counter",
|
||||
[]string{
|
||||
"device",
|
||||
"model_family",
|
||||
"model_name",
|
||||
"serial_number",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
metricDeviceStatus = prometheus.NewDesc(
|
||||
"smartctl_device_status",
|
||||
"Device status",
|
||||
|
@ -311,17 +300,6 @@ var (
|
|||
},
|
||||
nil,
|
||||
)
|
||||
metricAvailableSpare = prometheus.NewDesc(
|
||||
"available_spare",
|
||||
"Available spare",
|
||||
[]string{
|
||||
"device",
|
||||
"model_family",
|
||||
"model_name",
|
||||
"serial_number",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
metricDeviceErrorLogCount = prometheus.NewDesc(
|
||||
"smartctl_device_error_log_count",
|
||||
"Device SMART error log count",
|
||||
|
@ -334,17 +312,6 @@ var (
|
|||
},
|
||||
nil,
|
||||
)
|
||||
metricMediaErrors = prometheus.NewDesc(
|
||||
"media_errors",
|
||||
"Media errors counter",
|
||||
[]string{
|
||||
"device",
|
||||
"model_family",
|
||||
"model_name",
|
||||
"serial_number",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
metricDeviceSelfTestLogCount = prometheus.NewDesc(
|
||||
"smartctl_device_self_test_log_count",
|
||||
"Device SMART self test log count",
|
||||
|
@ -357,17 +324,6 @@ var (
|
|||
},
|
||||
nil,
|
||||
)
|
||||
metricSmartStatus = prometheus.NewDesc(
|
||||
"smart_status",
|
||||
"Smart status",
|
||||
[]string{
|
||||
"device",
|
||||
"model_family",
|
||||
"model_name",
|
||||
"serial_number",
|
||||
},
|
||||
nil,
|
||||
)
|
||||
metricDeviceSelfTestLogErrorCount = prometheus.NewDesc(
|
||||
"smartctl_device_self_test_log_error_count",
|
||||
"Device SMART self test log error count",
|
||||
|
|
46
smartctl.go
46
smartctl.go
|
@ -68,8 +68,6 @@ func (smart *SMARTctl) Collect() {
|
|||
smart.minePowerCycleCount()
|
||||
smart.mineDeviceSCTStatus()
|
||||
smart.mineDeviceStatistics()
|
||||
smart.mineNvmeSmartHealthInformationLog()
|
||||
smart.mineNvmeSmartStatus()
|
||||
smart.mineDeviceStatus()
|
||||
smart.mineDeviceErrorLog()
|
||||
smart.mineDeviceSelfTestLog()
|
||||
|
@ -442,37 +440,6 @@ func (smart *SMARTctl) mineLongFlags(json gjson.Result, flags []string) string {
|
|||
return strings.Join(result, ",")
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineNvmeSmartHealthInformationLog() {
|
||||
iHealth := smart.json.Get("nvme_smart_health_information_log")
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricCriticalWarning,
|
||||
prometheus.GaugeValue,
|
||||
iHealth.Get("critical_warning").Float(),
|
||||
smart.device.device,
|
||||
smart.device.family,
|
||||
smart.device.model,
|
||||
smart.device.serial,
|
||||
)
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricAvailableSpare,
|
||||
prometheus.GaugeValue,
|
||||
iHealth.Get("available_spare").Float(),
|
||||
smart.device.device,
|
||||
smart.device.family,
|
||||
smart.device.model,
|
||||
smart.device.serial,
|
||||
)
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricMediaErrors,
|
||||
prometheus.GaugeValue,
|
||||
iHealth.Get("media_errors").Float(),
|
||||
smart.device.device,
|
||||
smart.device.family,
|
||||
smart.device.model,
|
||||
smart.device.serial,
|
||||
)
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineDeviceStatus() {
|
||||
status := smart.json.Get("smart_status")
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
|
@ -486,19 +453,6 @@ func (smart *SMARTctl) mineDeviceStatus() {
|
|||
)
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineNvmeSmartStatus() {
|
||||
iStatus := smart.json.Get("smart_status")
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
metricSmartStatus,
|
||||
prometheus.GaugeValue,
|
||||
iStatus.Get("passed").Float(),
|
||||
smart.device.device,
|
||||
smart.device.family,
|
||||
smart.device.model,
|
||||
smart.device.serial,
|
||||
)
|
||||
}
|
||||
|
||||
func (smart *SMARTctl) mineDeviceErrorLog() {
|
||||
for logType, status := range smart.json.Get("ata_smart_error_log").Map() {
|
||||
smart.ch <- prometheus.MustNewConstMetric(
|
||||
|
|
Loading…
Reference in a new issue