Merge pull request #28 from lahwaacz/master

Skip vendor-specific statistics that lead to duplicate metric labels
This commit is contained in:
Ben Kochie 2022-10-20 11:42:19 +01:00 committed by GitHub
commit b832e55e3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -331,6 +331,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,