inventory

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(config ExecuteInventoryConfig) error

Types

type BMCInfo

type BMCInfo struct {
	MACAddr    string
	IPAddr     string
	SubnetMask string
	Gateway    string
	IPSource   string
	Firmware   string
}

BMCInfo holds information about an out-of-band management controller.

type CPUInfo

type CPUInfo struct {
	ModelName        string
	Architecture     string
	Flags            []string
	Microcode        string
	CoresPerCPU      string
	ThreadsPerCore   string
	AddressSizes     string
	SerialNumbers    []string
	LogicalCPUCount  int
	PhysicalCPUCount int
}

CPUInfo holds information about the system's CPUs.

type ChassisInfo

type ChassisInfo struct {
	Manufacturer string
	Model        string
	SerialNumber string
	Hostname     string
	BIOSVersion  string
	IsVirtual    bool
}

ChassisInfo holds information about the system chassis / motherboard.

type DIMMInfo

type DIMMInfo struct {
	Locator      string
	Size         string
	Speed        string
	SerialNumber string
}

DIMMInfo holds information about a single memory DIMM.

type DeviceRecord

type DeviceRecord struct {
	DeviceType     DeviceType      `json:"device_type"`
	DeviceName     string          `json:"device_name"`
	HostIdentifier string          `json:"host_identifier"`
	SerialNumber   string          `json:"serial_number"`
	Attributes     json.RawMessage `json:"attributes"`
}

DeviceRecord is the central schema for all inventory items. Every collected hardware component is normalised into this structure so that heterogeneous device data can be stored and queried uniformly.

type DeviceType

type DeviceType string

DeviceType identifies the class of hardware component.

const (
	DeviceTypeChassis DeviceType = "chassis"
	DeviceTypeBMC     DeviceType = "bmc"
	DeviceTypeCPU     DeviceType = "cpu"
	DeviceTypeMemory  DeviceType = "memory"
	DeviceTypeDisk    DeviceType = "disk"
	DeviceTypeNIC     DeviceType = "nic"
	DeviceTypeGPU     DeviceType = "gpu"
)

type DiskInfo

type DiskInfo struct {
	Name          string
	Type          DiskType
	SizeBytes     uint64
	SerialNumber  string
	Firmware      string
	BlockSize     string
	Speed         string
	Driver        string
	DriverVersion string
}

DiskInfo holds information about a single storage device.

type DiskType

type DiskType string

DiskType represents the type of storage device.

const (
	DiskTypeNVMe    DiskType = "nvme"
	DiskTypeSSD     DiskType = "ssd"
	DiskTypeHDD     DiskType = "hdd"
	DiskTypeUnknown DiskType = "unknown"
)

type ExecuteInventoryConfig

type ExecuteInventoryConfig struct {
	Debug         bool
	DbPath        string
	CollectorAddr string
}

type GPUInfo

type GPUInfo struct {
	Name          string
	PCIAddress    string
	Vendor        string
	Model         string
	SerialNumber  string
	VRAM          string
	Firmware      string
	Driver        string
	DriverVersion string
	NUMANode      string
}

GPUInfo holds information about a single GPU.

type IMEXNodeAttributes

type IMEXNodeAttributes struct {
	NodeIndex int    `json:"node_index"`
	IPAddress string `json:"ip_address"`
	Status    string `json:"status"`
	Version   string `json:"version"`
	Hostname  string `json:"hostname"`
	IsLocal   bool   `json:"is_local"`
}

IMEXNodeAttributes holds the parsed fields for a single IMEX domain peer.

type Inventory

type Inventory struct {
	DeviceRecords   []DeviceRecord
	NeighborRecords []NeighborRecord
}

func CollectInventory

func CollectInventory(ctx context.Context, debug bool) (*Inventory, error)

CollectInventory gathers inventory data from the environment. dbPath specifies where the output database file will be written.

func (*Inventory) RemoteWriter

func (inv *Inventory) RemoteWriter(ctx context.Context, addr string) error

RemoteWriter dials the inventory-collector gRPC service at addr and submits the full set of collected inventory data. addr should be a host:port string.

type LLDPNeighborAttributes

type LLDPNeighborAttributes struct {
	ChassisID         string `json:"chassisId"`
	PortID            string `json:"portId"`
	PortDescription   string `json:"portDesc"`
	SystemName        string `json:"systemName"`
	SystemDescription string `json:"systemDesc"`
	MgmtAddresses     string `json:"mgmtAddresses"`
}

LLDPNeighborAttributes holds the parsed LLDP TLV fields for a single neighbor discovered on a local interface.

type MemoryInfo

type MemoryInfo struct {
	TotalBytes uint64
	DIMMs      []DIMMInfo
}

MemoryInfo holds information about the system's memory.

type NICInfo

type NICInfo struct {
	Name      string
	MACAddr   string
	IPAddrs   []string
	Driver    string
	Firmware  string
	LinkSpeed string
	MTU       string
}

NICInfo holds information about a single network interface.

type NeighborRecord

type NeighborRecord struct {
	HostIdentifier string          `json:"host_identifier"`
	LocalInterface string          `json:"local_interface"`
	Attributes     json.RawMessage `json:"attributes"`
}

NeighborRecord maps directly to a row in the neighbors table.

Jump to

Keyboard shortcuts

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