From e10ded530fa96c91a2e1fb36763a63316738c5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sun, 3 Oct 2021 13:53:20 +0200 Subject: [PATCH 1/2] skip vendor-specific statistics that lead to duplicate metric labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #3 Signed-off-by: Jakub Klinkovský --- smartctl.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/smartctl.go b/smartctl.go index 3a3270b..4ea3432 100644 --- a/smartctl.go +++ b/smartctl.go @@ -330,6 +330,11 @@ func (smart *SMARTctl) mineSmartStatus() { func (smart *SMARTctl) mineDeviceStatistics() { for _, page := range smart.json.Get("ata_device_statistics.pages").Array() { table := strings.TrimSpace(page.Get("name").String()) + // skip vendor-specific statistics (they lead to duplicate metric labels on Seagate Exos drives, + // see https://github.com/Sheridan/smartctl_exporter/issues/3 for details) + if table == "Vendor Specific Statistics" { + continue; + } for _, statistic := range page.Get("table").Array() { smart.ch <- prometheus.MustNewConstMetric( metricDeviceStatistics, From e76e458118840d3507f42002b94ac8ec555500b3 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 19 Oct 2022 08:03:40 +0200 Subject: [PATCH 2/2] Update smartctl.go Signed-off-by: Ben Kochie Signed-off-by: Ben Kochie --- smartctl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartctl.go b/smartctl.go index 4ea3432..dfc3f93 100644 --- a/smartctl.go +++ b/smartctl.go @@ -333,7 +333,7 @@ func (smart *SMARTctl) mineDeviceStatistics() { // skip vendor-specific statistics (they lead to duplicate metric labels on Seagate Exos drives, // see https://github.com/Sheridan/smartctl_exporter/issues/3 for details) if table == "Vendor Specific Statistics" { - continue; + continue } for _, statistic := range page.Get("table").Array() { smart.ch <- prometheus.MustNewConstMetric(