From 56cd874440ee03810f2d9064a05a088b5d2b3fa2 Mon Sep 17 00:00:00 2001 From: Konstantin Shalygin Date: Thu, 13 Oct 2022 19:29:39 +0700 Subject: [PATCH] Removed doubled NVMe metrics Signed-off-by: Konstantin Shalygin --- metrics.go | 44 -------------------------------------------- smartctl.go | 46 ---------------------------------------------- 2 files changed, 90 deletions(-) diff --git a/metrics.go b/metrics.go index 7cc134b..31611db 100644 --- a/metrics.go +++ b/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", diff --git a/smartctl.go b/smartctl.go index a40a03a..d887f37 100644 --- a/smartctl.go +++ b/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(