fix(overlays): backport smartctl_exporter Describe fix (upstream #329)

smartctl_exporter 0.14.0 derives Describe() from the devices it can read at startup. A device that only becomes readable later (an NVMe whose ACL arrives late, or an HDD waking from standby) then makes Collect() emit metrics with unregistered descriptors, so /metrics returns HTTP 500 and the whole scrape fails, hiding even the healthy disks.

Backport upstream PR #329, which makes Describe() send the full explicit descriptor set. Carry it as an overlay until smartctl_exporter 0.15.0 is released and packaged in nixpkgs.

Refs: https://github.com/prometheus-community/smartctl_exporter/pull/329
This commit is contained in:
Ryan Yin committed 2026-10-03 12:49:36 +08:00
1 parent d5fa86dbc7
commit e8764b802a
3 files changed
+71

No files matched your search

+6
View File
@@ -13,6 +13,9 @@ overlays/
├── default.nix # Entrypoint for all overlays
├── computer-use-linux.nix # trycua/computer-use-linux package
├── cua-driver.nix # trycua/cua driver (cua-driver) package
├── smartctl-exporter/ # smartctl_exporter backport (upstream PR #329)
│ ├── default.nix
│ └── 329-explicit-descriptors.patch
└── fcitx5/ # Chinese input method configuration
├── README.md
├── default.nix # fcitx5 overlay definition
@@ -55,3 +58,6 @@ This overlay provides:
- `computer-use-linux.nix`: packages `pkgs/computer-use-linux`.
- `cua-driver.nix`: packages `pkgs/cua-driver` (used by the computer-use VMs).
- `smartctl-exporter/`: patches `prometheus-smartctl-exporter` with upstream PR
[#329](https://github.com/prometheus-community/smartctl_exporter/pull/329) until smartctl_exporter
0.15.0 is released; see `overlays/smartctl-exporter/default.nix`.
@@ -0,0 +1,50 @@
diff --git a/main.go b/main.go
index c5b138a..05a222e 100644
--- a/main.go
+++ b/main.go
@@ -57,7 +57,44 @@ type SMARTctlManagerCollector struct {
// Describe sends the super-set of all possible descriptors of metrics
func (i *SMARTctlManagerCollector) Describe(ch chan<- *prometheus.Desc) {
- prometheus.DescribeByCollect(i, ch)
+ ch <- metricSmartctlVersion
+ ch <- metricDeviceModel
+ ch <- metricDeviceCount
+ ch <- metricDeviceCapacityBlocks
+ ch <- metricDeviceCapacityBytes
+ ch <- metricDeviceTotalCapacityBytes
+ ch <- metricDeviceBlockSize
+ ch <- metricDeviceInterfaceSpeed
+ ch <- metricDeviceAttribute
+ ch <- metricDevicePowerOnSeconds
+ ch <- metricDeviceRotationRate
+ ch <- metricDeviceTemperature
+ ch <- metricDevicePowerCycleCount
+ ch <- metricDevicePercentageUsed
+ ch <- metricDeviceAvailableSpare
+ ch <- metricDeviceAvailableSpareThreshold
+ ch <- metricDeviceCriticalWarning
+ ch <- metricDeviceMediaErrors
+ ch <- metricDeviceNumErrLogEntries
+ ch <- metricDeviceBytesRead
+ ch <- metricDeviceBytesWritten
+ ch <- metricDeviceSmartStatus
+ ch <- metricDeviceExitStatus
+ ch <- metricDeviceState
+ ch <- metricDeviceStatistics
+ ch <- metricDeviceErrorLogCount
+ ch <- metricDeviceSelfTestLogCount
+ ch <- metricDeviceSelfTestLogErrorCount
+ ch <- metricDeviceERCSeconds
+ ch <- metricSCSIGrownDefectList
+ ch <- metricReadErrorsCorrectedByRereadsRewrites
+ ch <- metricReadErrorsCorrectedByEccFast
+ ch <- metricReadErrorsCorrectedByEccDelayed
+ ch <- metricReadTotalUncorrectedErrors
+ ch <- metricWriteErrorsCorrectedByRereadsRewrites
+ ch <- metricWriteErrorsCorrectedByEccFast
+ ch <- metricWriteErrorsCorrectedByEccDelayed
+ ch <- metricWriteTotalUncorrectedErrors
}
// Collect is called by the Prometheus registry when collecting metrics.
+15
View File
@@ -0,0 +1,15 @@
# smartctl_exporter 0.14.0 derives `Describe()` from the devices it can read at
# startup, so when a device only becomes readable later (an NVMe whose ACL
# arrives late, or an HDD waking from standby) `Collect()` emits metrics whose
# descriptors were never registered and `/metrics` starts returning HTTP 500,
# which fails the whole scrape and hides even the healthy disks.
#
# Backport of upstream PR #329: `Describe()` now sends the full, explicit
# descriptor set. Drop this overlay once smartctl_exporter 0.15.0 is released
# and packaged in nixpkgs:
# https://github.com/prometheus-community/smartctl_exporter/pull/329
_: _final: prev: {
prometheus-smartctl-exporter = prev.prometheus-smartctl-exporter.overrideAttrs (prevAttrs: {
patches = (prevAttrs.patches or [ ]) ++ [ ./329-explicit-descriptors.patch ];
});
}