Repository navigation
os: add windows_os_reboot_required metric - #2871
Merged
Merged
Conversation
Read the registry locations that Windows uses to record a pending reboot and expose one series per reason: component based servicing, Windows Update, pending file rename operations and a pending computer rename. The registry collector can only read values, not test whether a key exists or compare two values. Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
Leave a reason out with a warning when the exporter's account may not read its registry location, so a restricted ACL doesn't fail every scrape. Count a rename list of an unexpected type as pending. Check the emitted series in the collector test. Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
jkroepke
marked this pull request as ready for review
December 3, 2026 20:28
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.
Requested by Joe · project thread
What this PR does / why we need it
Adds
windows_os_reboot_required{reason}(gauge, 0/1) to theoscollector. It reads the registry locations Windows uses to record a pending reboot, one series per reason:reasoncomponent_servicingHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPendingexistswindows_updateHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequiredexistsfile_renamePendingFileRenameOperations/PendingFileRenameOperations2underSession Manageris non-emptycomputer_renameComputerName\ComputerNamediffers fromComputerName\ActiveComputerNameMost other Windows agents ship this check (NSClient++
check_pending_reboot, Zabbix and Datadog templates, the usual PowerShell pending-reboot scripts). Theregistrycollector can't express it: it reads values, but cannot test whether a key exists or compare two values.file_renameis kept as its own reason because installers and antivirus set it often; the documented query and alert example leave it out.Which issue this PR fixes
None open. Older requests were closed as stale.
Special notes for your reviewer
oscollector. Any other read error leaves the reason out and is joined into the collector error; the other reasons are still published. I expect all locations to be readable byBUILTIN\Users(and so by the service's virtual account), but haven't verified that on a live host.windows_updateis a label value, so it is added toignoredReferencesininternal/metriccontract.docs/collector.os.mdhas a query and an alert example. A mixin alert with runbook can follow.This PR was written in part with the assistance of generative AI.
Particularly user-facing changes
New metric
windows_os_reboot_required{reason}.Checklist
Generated by Claude Code