systeminfo

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package systeminfo is a generated GoMock package.

Index

Constants

View Source
const (
	// PCI class codes for graphics devices
	VGACompatibleController = "0x030000" // VGA compatible controller
	DisplayController       = "0x038000" // Other display controller
	ThreeDController        = "0x030200" // 3D controller

	// Class code prefixes for graphics devices
	VGAPrefix     = "0x0300" // Prefix for VGA compatible devices
	DisplayPrefix = "0x0380" // Prefix for other display controllers
)

ref, https://admin.pci-ids.ucw.cz/read/PD

View Source
const (

	// SystemFileName is the name of the file where the system boot status is stored in the data-dir.
	SystemFileName = "system.json"
	// HardwareMapFileName is the name of the file where the hardware map is stored.
	HardwareMapFileName = "hardware-map.yaml"
)

Variables

View Source
var SupportedInfoKeys = map[string]func(info *Info) string{
	// contains filtered or unexported fields
}

SupportedInfoKeys is a map of supported info keys to their corresponding functions.

Functions

func NewManager

func NewManager(
	log *log.PrefixLogger,
	exec executer.Executer,
	readWriter fileio.ReadWriter,
	dataDir string,
	infoKeys []string,
	customKeys []string,
	collectionTimeout util.Duration,
) *manager

Types

type BIOSInfo

type BIOSInfo struct {
	Vendor  string `json:"vendor"`
	Version string `json:"version"`
	Date    string `json:"date,omitempty"`
}

BIOSInfo represents BIOS information

type BlockInfo

type BlockInfo struct {
	TotalSizeBytes uint64      `json:"totalSizeBytes"`
	TotalSizeGB    float64     `json:"totalSizeGb"`
	Disks          []DiskInfo  `json:"disks"`
	Mounts         []MountInfo `json:"mounts,omitempty"`
}

BlockInfo represents block device information

type Boot

type Boot struct {
	// Time is the time the system was booted.
	Time string `json:"bootTime,omitempty"`
	// ID is the unique boot ID populated by the kernel.
	ID string `json:"bootID,omitempty"`
}

func (*Boot) IsEmpty

func (b *Boot) IsEmpty() bool

type CPUInfo

type CPUInfo struct {
	TotalCores   int             `json:"total_cores"`
	TotalThreads int             `json:"total_threads"`
	Architecture string          `json:"architecture"`
	Processors   []ProcessorInfo `json:"processors"`
}

CPUInfo represents CPU information

type CollectOpt added in v0.7.0

type CollectOpt func(*collectCfg)

func WithAll added in v0.10.0

func WithAll() CollectOpt

WithAll runs all custom collectors and all flight control defined default collectors.

func WithAllCustom added in v0.7.0

func WithAllCustom() CollectOpt

WithAllCustom enables all custom collection.

type CollectorFn added in v0.7.0

type CollectorFn func(ctx context.Context) string

CollectorFn is a function that collects system information. Collectors are best effort and should log any errors.

type DefaultRoute

type DefaultRoute struct {
	Interface string `json:"interface"`
	Gateway   string `json:"gateway"`
	Family    string `json:"family"` // "ipv4" or "ipv6"
}

DefaultRoute represents the default network route for IPv4 or IPv6.

type DiskInfo

type DiskInfo struct {
	Name              string          `json:"name"`
	SizeBytes         uint64          `json:"sizeBytes"`
	SizeGB            float64         `json:"sizeGb"`
	DriveType         string          `json:"driveType"`
	StorageController string          `json:"storageController"`
	Vendor            string          `json:"vendor,omitempty"`
	Model             string          `json:"model,omitempty"`
	SerialNumber      string          `json:"serialNumber,omitempty"`
	WWN               string          `json:"wwn,omitempty"`
	BusType           string          `json:"busType,omitempty"`
	Partitions        []PartitionInfo `json:"partitions,omitempty"`
}

DiskInfo contains information about a single disk

type GPUDeviceInfo

type GPUDeviceInfo struct {
	Index       int      `json:"index"`
	Vendor      string   `json:"vendor"`
	Model       string   `json:"model"`
	DeviceID    string   `json:"deviceId,omitempty"`
	PCIAddress  string   `json:"pciAddress,omitempty"`
	RevisionID  string   `json:"revisionId,omitempty"`
	VendorID    string   `json:"vendorId,omitempty"`
	MemoryBytes uint64   `json:"memoryBytes,omitempty"`
	Arch        string   `json:"architecture,omitempty"`
	Features    []string `json:"features,omitempty"`
}

GPUDeviceInfo contains information about a GPU device

type GPUInfo

type GPUInfo struct {
	GPUs []GPUDeviceInfo `json:"gpus"`
}

GPUInfo represents GPU information

type HardwareFacts

type HardwareFacts struct {
	CPU     *CPUInfo        `json:"cpu,omitempty"`
	Memory  *MemoryInfo     `json:"memory,omitempty"`
	Block   *BlockInfo      `json:"block,omitempty"`
	Network *NetworkInfo    `json:"network,omitempty"`
	GPU     []GPUDeviceInfo `json:"gpu,omitempty"`
	BIOS    *BIOSInfo       `json:"bios,omitempty"`
	System  *SystemInfo     `json:"system,omitempty"`
}

HardwareFacts contains hardware information gathered by ghw

type Info

type Info struct {
	Hostname        string                 `json:"hostname"`
	Architecture    string                 `json:"architecture"`
	OperatingSystem string                 `json:"operatingSystem"`
	Kernel          string                 `json:"kernel"`
	Distribution    map[string]interface{} `json:"distribution,omitempty"`
	Hardware        HardwareFacts          `json:"hardware"`
	CollectedAt     string                 `json:"collectedAt"`
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	Boot            Boot                   `json:"boot,omitempty"`
	Custom          map[string]string      `json:"custom,omitempty"`
}

func Collect added in v0.7.0

func Collect(ctx context.Context, log *log.PrefixLogger, exec executer.Executer, reader fileio.Reader, customKeys []string, hardwareMapFilePath string, opts ...CollectOpt) (*Info, error)

Collect collects system information and returns it as a map of key-value pairs.

type InterfaceInfo

type InterfaceInfo struct {
	Name        string   `json:"name"`
	MACAddress  string   `json:"macAddress"`
	IsVirtual   bool     `json:"isVirtual"`
	IPAddresses []string `json:"ipAddresses,omitempty"`
	MTU         int      `json:"mtu,omitempty"`
	Status      string   `json:"status,omitempty"`
}

InterfaceInfo contains information about a network interface

type Manager

type Manager interface {
	// IsRebooted checks if the system has been rebooted since the last time the agent started
	IsRebooted() bool
	// BootID returns the unique boot ID populated by the kernel
	BootID() string
	// BootTime returns the time the system was booted
	BootTime() string
	// RegisterCollector registers a system info collector
	RegisterCollector(ctx context.Context, name string, fn CollectorFn)
	status.Exporter
}

type MemoryInfo

type MemoryInfo struct {
	TotalKB uint64                 `json:"totalKb"`
	Details map[string]interface{} `json:"details,omitempty"`
}

MemoryInfo represents memory information

type MockManager

type MockManager struct {
	// contains filtered or unexported fields
}

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) BootID

func (m *MockManager) BootID() string

BootID mocks base method.

func (*MockManager) BootTime

func (m *MockManager) BootTime() string

BootTime mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) IsRebooted

func (m *MockManager) IsRebooted() bool

IsRebooted mocks base method.

func (*MockManager) RegisterCollector added in v0.7.0

func (m *MockManager) RegisterCollector(ctx context.Context, name string, fn CollectorFn)

RegisterCollector mocks base method.

func (*MockManager) Status

func (m *MockManager) Status(arg0 context.Context, arg1 *v1beta1.DeviceStatus, arg2 ...status.CollectorOpt) error

Status mocks base method.

type MockManagerMockRecorder

type MockManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) BootID

func (mr *MockManagerMockRecorder) BootID() *gomock.Call

BootID indicates an expected call of BootID.

func (*MockManagerMockRecorder) BootTime

func (mr *MockManagerMockRecorder) BootTime() *gomock.Call

BootTime indicates an expected call of BootTime.

func (*MockManagerMockRecorder) IsRebooted

func (mr *MockManagerMockRecorder) IsRebooted() *gomock.Call

IsRebooted indicates an expected call of IsRebooted.

func (*MockManagerMockRecorder) RegisterCollector added in v0.7.0

func (mr *MockManagerMockRecorder) RegisterCollector(ctx, name, fn any) *gomock.Call

RegisterCollector indicates an expected call of RegisterCollector.

func (*MockManagerMockRecorder) Status

func (mr *MockManagerMockRecorder) Status(arg0, arg1 any, arg2 ...any) *gomock.Call

Status indicates an expected call of Status.

type MountInfo

type MountInfo struct {
	Device     string `json:"device"`
	MountPoint string `json:"mountPoint"`
	FSType     string `json:"fsType"`
	Options    string `json:"options"`
}

MountInfo contains information about a filesystem mount

type NetworkInfo

type NetworkInfo struct {
	Interfaces   []InterfaceInfo `json:"interfaces"`
	DefaultRoute *DefaultRoute   `json:"defaultRoute,omitempty"`
	DNSServers   []string        `json:"dnsServers,omitempty"`
	FQDN         string          `json:"fqdn,omitempty"`
}

NetworkInfo represents network information

type PCIModelInfo

type PCIModelInfo struct {
	PCIID       string   `json:"pciID"`
	PCIName     string   `json:"pciName"`
	MemoryBytes uint64   `json:"memoryBytes,omitempty"`
	Arch        string   `json:"architecture,omitempty"`
	Features    []string `json:"features,omitempty"`
}

PCIModelInfo contains information about a specific GPU model

type PCIVendorInfo

type PCIVendorInfo struct {
	Models     []PCIModelInfo `json:"models"`
	VendorID   string         `json:"vendorID"`
	VendorName string         `json:"vendorName"`
}

PCIVendorInfo contains mapping information for vendors and models

type PartitionInfo

type PartitionInfo struct {
	Name       string  `json:"name"`
	SizeBytes  uint64  `json:"sizeBytes"`
	SizeGB     float64 `json:"sizeGb"`
	MountPoint string  `json:"mountPoint,omitempty"`
	Type       string  `json:"type,omitempty"`
	IsReadOnly bool    `json:"isReadOnly,omitempty"`
}

PartitionInfo contains information about a disk partition

type ProcessorInfo

type ProcessorInfo struct {
	ID                int      `json:"id"`
	NumCores          int      `json:"numCores"`
	NumThreads        int      `json:"numThreads"`
	NumThreadsPerCore int      `json:"numThreadsPerCore"`
	Vendor            string   `json:"vendor"`
	Model             string   `json:"model"`
	Capabilities      []string `json:"capabilities,omitempty"`
}

ProcessorInfo contains information about a single processor

type SystemInfo

type SystemInfo struct {
	Manufacturer string `json:"manufacturer"`
	ProductName  string `json:"productName"`
	SerialNumber string `json:"serialNumber,omitempty"`
	UUID         string `json:"uuid,omitempty"`
	Version      string `json:"version,omitempty"`
	Family       string `json:"family,omitempty"`
	SKU          string `json:"sku,omitempty"`
}

SystemInfo represents system information

Jump to

Keyboard shortcuts

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