Repository navigation
fix(collector): skip unidentified devices, add exclude list and bounded parallel collection - #969
Merged
Merged
Conversation
…ded parallel collection - Skip registration of devices whose smartctl --info call failed (fatal exit status, no output, undecodable output) on linux, darwin, windows and freebsd. Non-fatal exit bits (for example 4, #663) still register. - Add an exclude list of regular expressions matched against device path, model name and device type, plus a default-on exclusion of emulated disks (QEMU HARDDISK, VBOX HARDDISK, Virtual Disk, Msft Virtual Disk) that is disabled with exclude_virtual_disks: false. Excluded devices log once at INFO and are not reported as failed. - Add commands.metrics_parallelism (default 1) to collect SMART data for several devices at once, and guard the memoized device overrides in the collector config against concurrent reads.
…t explicit devices Devices left out of registration because smartctl --info failed are recorded in Detect.Skipped and sent as an info scan error on every run, so a failing drive still raises a collector error. Exclude patterns are compiled once per scan. The built-in virtual disk patterns no longer apply to devices named in the devices section or allow_listed_devices. Parallelism tests use a barrier instead of sleeps.
…er wait BREAKING CHANGE: devices whose smartctl --info call fails are no longer registered; the failure is reported as a collector scan error instead. Disks whose model is QEMU HARDDISK, VBOX HARDDISK, Virtual Disk or Msft Virtual Disk are skipped by default unless listed explicitly under devices or allow_listed_devices, or exclude_virtual_disks is set to false.
3 of 14 tasks
This was referenced Oct 13, 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
WP-D (collector robustness) for the 2.0.0 release. The collector stops registering devices it could not identify, gains an
exclude:list plus a built-in virtual-disk exclusion, and can collect SMART data from several devices in parallel (default unchanged: one at a time).Type of Change
Related Issues
Related to #965. Addresses #913 and #912.
Changes Made
smartctl --infofails: fatal exit status, non-exit errors such as timeout or missing binary, empty output, or undecodable JSON. Non-fatal exit bits (for example exit 4, fix(collector): preserve jmb39x-q device type and accept usable SMART JSON #663) still register. Previously these devices registered without identity and were a likely source of duplicate devices. Each skipped device is reported every run as a collector scan error (ReportScanError("info", ...)), which notifies throughnotify_on_collector_errorlike before, so a hard-failing drive still alerts.exclude:list of regexes matched against device path, model name, and device type; invalid patterns are skipped with a WARN. Checked before--info(path, type) and after it (model).exclude_virtual_disks(defaulttrue): skipsQEMU HARDDISK,VBOX HARDDISK, andVirtual Disk/Msft Virtual Diskmodels, case-insensitive, with one INFO line. Devices listed explicitly underdevices:or inallow_listed_devicesare never skipped by the built-in list; userexclude:patterns still apply. Patterns compile once per scan.commands.metrics_parallelism(default1, today's behavior; values below 1 are treated as 1).metrics_smartctl_waitnow applies per worker.config.GetDeviceOverrides()memoization found by-race.example.collector.yamlanddocs/TROUBLESHOOTING_DEVICE_COLLECTOR.md.Testing
go build ./...,go vet ./...,go test -race ./collector/...,go test ./...,GOOS=windows|freebsd|darwin go vet ./collector/...clean,GOOS=linux golangci-lint run --new-from-rev=origin/beta ./...(v2.14.0) 0 issues. New tests cover fatal, timeout, empty, and bad-JSON--info(unregistered, recorded, one scan error each) versus exit-4, virtual-disk exclusion on and off, user patterns including an invalid regex, type exclusion, and explicit devices exempt from built-ins, and parallelism 1/3/0 with a channel barrier for peak concurrency.Checklist
Notes
exclude_virtual_disks: false. Previously registered devices in either group stop updating; they are not archived.excludemust be a YAML list; theCOLLECTOR_EXCLUDEenv var splits on whitespace.metrics_parallelismabove 1, collector config is read from several goroutines; avoidSet()on it after startup.collector/pkg/mdadm/detect/mount_linux.go:98failsGOOS=linux go vetfrom arm64 hosts.Review: not required (collector change on the
betaintegration branch; no production effect until a release, but an independent read-only review is being run per release coordination)