Repository navigation
fix(collector): pass explicitly configured smartctl device types verbatim - #678
Merged
Merged
Conversation
…atim Some Hitachi and Toshiba drives answer an auto-detected smartctl query with no identity, "SMART support is: Unavailable" and no attributes, which Scrutiny renders as a failed disk with zero metrics. The documented remedy is to pin the device type in collector.yaml, and for most of these drives that type is `sat`, which already reached smartctl. A type of `scsi` or `ata` did not. All three smartctl call sites (detection --info, collection --xall, and the FARM log) carried a hand-copied guard that dropped `scsi` and `ata` before appending --device. The guard is right for a type that came from `smartctl --scan`, since container scans routinely mislabel ATA disks as SCSI and forcing -d scsi loses the ATA attributes. It is wrong for a type the user wrote down, but models.Device carries no provenance, so the two were indistinguishable. The comparison was also exact-case, so `type: 'ATA'` was passed while `type: 'ata'` was dropped. Replace all three copies with detect.AppendDeviceTypeArgs, which resolves provenance from Config.GetDeviceOverrides() at the call site. A type configured for that device path is passed verbatim, including `scsi` and `ata`; a type that is not configured keeps the existing suppression, now case-insensitive. The lookup cannot use a field on models.Device because the device type round-trips through /api/devices/register before Collect reads it back. Behavior change on upgrade: a `type: 'scsi'` or `type: 'ata'` entry that was a no-op in earlier releases now takes effect. The troubleshooting doc says so and tells users to remove the entry if they want auto-detection. Fixes #664
The auto-detected fixture has no wwn block, so SmartCtlInfo falls through to the platform-specific wwnFallback. On Linux that reads the real disk at /dev/sda, so the WWN is empty only on hosts without one. Assert the fixture-derived fields instead.
Owner
Author
Merged (2026-07-28)Changes Made
Upgrade noteA
|
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some Hitachi and Toshiba drives answer an auto-detected
smartctlquery with no identity,SMART support is: Unavailableand no attributes. Scrutiny renders that as a failed disk with zero metrics. The documented remedy is to pin the device type incollector.yaml; for most of these drives that type issat, which already reached smartctl. A configured type ofscsioratadid not.All three smartctl call sites (detection
--info, collection--xall, FARM log) carried a hand-copied guard:The guard is correct for a type that came from
smartctl --scan: container scans routinely mislabel ATA disks as SCSI, and forcing-d scsion one loses its ATA attributes. It is wrong for a type the user wrote down, butmodels.Devicecarries no provenance, so the two were indistinguishable. The comparison was also exact-case, sotype: 'ATA'was passed through whiletype: 'ata'was dropped.Changes
detect.AppendDeviceTypeArgsis now the only place a device type becomes smartctl arguments. All three call sites route through it, so they cannot drift apart.collector.yamlis passed verbatim, includingscsiandata. A type that is not configured keeps the existing suppression, now trimmed and case-insensitive.Config.GetDeviceOverrides()(already on the interface, memoized). It cannot be a field onmodels.Device: the device type round-trips through/api/devices/registerbeforeCollectreads it back, so a collector-only field would not survive.nvmeis unchanged and still passed through.Behavior change on upgrade
A
type: 'scsi'ortype: 'ata'entry that was a silent no-op in earlier releases now takes effect. For a drive that was working through auto-detection, that can lose attributes. The troubleshooting doc calls this out and tells users to delete the entry if they want auto-detection. Worth repeating in the release notes.Tests
go test ./collector/...passes. New coverage:detect_test.go: configuredsatreaches the--infoargv and populates model, serial, WWN andsmart_support.available; the auto-detected response for the same drive yields the empty identity that produces the false failure; configuredscsiis now passed; a configured device that inherits a scannedscsistill suppresses it; an uppercase scannedSCSIis suppressed.TestDetect_AppendDeviceTypeArgs: table over the resolution rules, including a type configured for a different device path.metrics_collect_test.go: configuredsatreaches both the--xalland FARM calls; configuredscsiis passed; a scannedscsiwith nothing configured produces neither--device.collector/pkg/detect/testdata/.Docs
docs/TROUBLESHOOTING_DEVICE_COLLECTOR.md: new section on drives reported as failed with zero SMART values, with thesmartctl -avssmartctl -a -d satdiagnosis and the upgrade note.example.collector.yaml: states that a configured type is passed verbatim.Fixes #664