hostfacts

package
v0.1.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package hostfacts gathers OS and patch facts about the physical box (OS name and version, kernel, pending security updates, and whether a reboot is required), so the agent can report them to the control plane for the operator fleet view. The cheap facts (OS, kernel) are read every call; the expensive security-update check spawns a process and is cached, refreshed at most every few hours.

Every read is defensive: a failure yields a zero value, or nil for the security count (so "unknown" stays distinct from "zero, patched"), rather than an error, so a miss never sinks a status report. British English throughout. No em dashes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Facts

type Facts struct {
	OSName    string
	OSVersion string
	Kernel    string
	// SecurityUpdates is the count of pending security updates, or nil when it could
	// not be determined, so the control plane can tell "0, patched" from "unknown".
	SecurityUpdates *int
	RebootRequired  bool
	// UptimeSeconds is how long the box has been up. Lets the control plane detect a
	// reboot (uptime resets), so an admin reboot request self-clears. 0 = not determined.
	UptimeSeconds int64
}

Facts is what the agent reports about the host's OS and patch state. Empty fields are omitted from the status report and never overwrite a known-good Host value.

func Detect

func Detect() Facts

Detect reads the host's OS and patch facts. OS and kernel are read every call (cheap file reads); the security-update count and reboot flag are cached and refreshed at most once every patchTTL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL