facts¶
Package facts provides system information collection for different operating systems.
Index¶
- func ClearCache()
- type Disk
- type Facts
- func Collect() *Facts
- func (f *Facts) ToMap() map[string]interface{}
- type GPU
- type NetworkInterface
- type OllamaModel
- type ToolSpec
func ClearCache¶
ClearCache forces re-collection on next Collect() call. This is primarily intended for testing purposes.
type Disk¶
Disk represents a storage device.
type Disk struct {
Device string
MountPoint string
Filesystem string
SizeGB int64
UsedGB int64
AvailGB int64
UsedPct int
}
type Facts¶
Facts contains collected system information.
type Facts struct {
// Basic
OS string
Arch string
Hostname string
Username string
UserHome string
// Distribution (Linux)
Distribution string
DistributionVersion string
DistributionMajor string
DistributionCodename string // VERSION_CODENAME from /etc/os-release (e.g. "jammy", "bookworm")
// Network
IPAddresses []string
NetworkInterfaces []NetworkInterface
// Hardware
CPUCores int
MemoryTotalMB int64
Disks []Disk
GPUs []GPU
// OS Details
KernelVersion string // "6.5.0-14-generic" (Linux), "23.6.0" (macOS)
// CPU Extended
CPUModel string // "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz"
CPUFlags []string // ["avx", "avx2", "sse4_2", "fma", ...]
// Memory Extended
MemoryFreeMB int64 // Available memory
SwapTotalMB int64 // Swap size
SwapFreeMB int64 // Swap available
// Network Extended
DefaultGateway string // "192.168.1.1"
DNSServers []string // ["8.8.8.8", "1.1.1.1"]
// Software
PythonVersion string
PackageManager string
// Toolchains
DockerVersion string // "24.0.7"
GitVersion string // "2.43.0"
GoVersion string // "1.21.5"
// Extended toolchains (name → version string, empty if not found)
Tools map[string]string
// Ollama (optional)
OllamaVersion string // "0.1.47"
OllamaModels []OllamaModel // List of installed models
OllamaEndpoint string // "http://localhost:11434"
// Uptime
UptimeSeconds int64 // seconds since boot
// Services
FailedServices []string // services in failed state
StoppedServices []string // key services that are stopped/inactive
}
func Collect¶
Collect gathers system facts with per-process caching. Facts are collected only once per execution and cached in memory.
func (*Facts) ToMap¶
ToMap converts Facts to a map for use in templates.
type GPU¶
GPU represents a graphics card.
type GPU struct {
Vendor string // nvidia, amd, intel
Model string
Memory string // e.g. "8GB", "24GB"
Driver string
CUDAVersion string // "12.3" (NVIDIA only)
}
type NetworkInterface¶
NetworkInterface represents a network interface.
type OllamaModel¶
OllamaModel represents an installed Ollama model.
type OllamaModel struct {
Name string // e.g., "llama3.1:8b"
Size string // e.g., "4.7 GB"
Digest string // SHA256 hash
ModifiedAt string // ISO timestamp
}
type ToolSpec¶
ToolSpec describes how to probe one CLI tool for its version. This is the public form used in YAML and by callers.
type ToolSpec struct {
Cmd string `yaml:"cmd"`
Args []string `yaml:"args"`
Prefix string `yaml:"prefix,omitempty"`
Parser string `yaml:"parser,omitempty"` // "" or "json_field"
JSONKey string `yaml:"json_key,omitempty"` // key for json_field parser
StripSuffix bool `yaml:"strip_suffix,omitempty"` // strip -(build) suffixes
}
Generated by gomarkdoc