Skip to content

Conversation

@frank-wettstein
Copy link

This pull request addresses the issue described in #298, where using multiple devices specified like:

smartctl_exporter --smartctl.device="/dev/sda;cciss,0" --smartctl.device="/dev/sda;cciss,1"

results in the following error on the metrics endpoint:

was collected before with the same name and label values

In #274, an solution has been implemented adressing this issue. This PR provides an alternative fix by reusing the device labels already created in main.go, instead of reconstructing the label from the smartctl JSON response. Rebuilding the label from the JSON leads to duplicate or incorrect label values.

For the example above, main.go produces the following correct and unique device labels:

sda_cciss_0
sda_cciss_1

However, in smartctl.go, both devices receive the same label (sda) because the smartctl JSON response contains only:


 "device": {
    "name": "/dev/sda",
    "info_name": "/dev/sda [cciss_disk_00] [SCSI]",
    "type": "cciss",
    "protocol": "SCSI"
  },

This mismatch results in non-unique labels and ultimately in metric collisions.
By reusing the pre-computed labels from main.go, the collision ist avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant