Repository navigation
Conversation
Export the Warning Composite Temperature Time and Critical Composite Temperature Time fields of the NVMe SMART / Health Information log as smartctl_device_warning_temperature_seconds_total and smartctl_device_critical_temperature_seconds_total. The device keeps these as cumulative counts of whole minutes during which its composite temperature was at or above its warning (WCTEMP) and critical (CCTEMP) thresholds. Unlike the point-in-time temperature gauge they show overheating that happened between scrapes. Values are converted to seconds and exposed as counters labelled by device like the other NVMe metrics, only for NVMe devices. Because the device reports whole minutes, rate() moves in 60 s steps. These are time-above-threshold counters, not the thermal management throttling counters, which smartctl only prints as text. smartctl reports the fields as warning_temp_time and critical_comp_time in nvme_smart_health_information_log since JSON output was introduced in 7.0, and --attributes already requests the log. smartctl omits a field when both its value and the controller's matching threshold (WCTEMP/CCTEMP) are zero, so the metric is only exported when the field is present and a series may first appear with a non-zero value. The two fields were requested in prometheus-community#272. unsafe_shutdowns, also asked for there, is not exported: a maintainer noted in that issue that it effectively counts host shutdowns, so it carries little drive-health signal. The tests use github.com/prometheus/client_golang/prometheus/testutil, which adds the github.com/kylelemons/godebug indirect line to go.mod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
jhoblitt
marked this pull request as ready for review
November 30, 2026 23:10
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.
Motivation
An NVMe drive records how long its composite temperature has been at or above its warning and critical thresholds. A point-in-time temperature gauge misses excursions between scrapes, and these fields were asked for in #272.
What changed
smartctl_device_warning_temperature_seconds_totalandsmartctl_device_critical_temperature_seconds_totalfor NVMe devices, fromwarning_temp_time/critical_comp_time(minutes, converted to seconds). No new smartctl arguments.Notable decisions
unsafe_shutdownsis left out, following the discussion in #272.This PR was prepared with an AI coding assistant (Claude Code) at my direction; I own it.