inventory

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inventory provides lightweight system inventory collection using standard Linux interfaces (/proc, /etc, standard tools) without requiring osquery. Command-backed collectors run through an injected exec.Runner.

r, _ := exec.NewRunner(exec.Direct)
inv, _ := inventory.New(r)
sys, _ := inv.System(ctx)

Status: SDK-resident, single-consumer today (the agent's connect-time inventory snapshot). The package lives in the SDK rather than under agent/internal/sys because the planned server-side compliance preview needs the same parsers. F027 in TECH_DEBT_AUDIT.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	System(ctx context.Context) (*SystemInfo, error)
	OS() (*OSInfo, error)
	Disks(ctx context.Context) ([]DiskInfo, error)
	NetworkInterfaces(ctx context.Context) ([]NetworkInterface, error)
}

Collector gathers system inventory. Command-backed methods run through the injected Runner; OS() is a pure /etc/os-release read.

func New

func New(runner exec.Runner) (Collector, error)

New returns a Collector driven by runner. A nil runner is rejected.

type DiskInfo

type DiskInfo struct {
	Device string // e.g. "/dev/sda"
	Size   string // e.g. "500G" (human-readable from lsblk)
	Type   string // e.g. "disk", "part"
	Mount  string // e.g. "/"
}

DiskInfo holds block device information.

type NetworkInterface

type NetworkInterface struct {
	Name      string
	MAC       string
	Addresses []string // e.g. ["192.168.1.100/24", "fe80::1/64"]
	State     string   // "UP" or "DOWN"
}

NetworkInterface holds network interface details.

type OSInfo

type OSInfo struct {
	Name       string // e.g. "Fedora Linux"
	Version    string // e.g. "43"
	ID         string // e.g. "fedora"
	PrettyName string // e.g. "Fedora Linux 43 (Workstation Edition)"
	VersionID  string // e.g. "43"
	Arch       string // e.g. "x86_64" (runtime.GOARCH)
}

OSInfo holds operating system identification details.

type SystemInfo

type SystemInfo struct {
	Hostname      string
	CPUModel      string
	CPUCores      int
	MemoryTotalMB int64
	Arch          string
	KernelVersion string
}

SystemInfo holds basic hardware and kernel information.

Jump to

Keyboard shortcuts

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