mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-12-04 11:36:20 +01:00
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
51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
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.
|