Documentation
¶
Overview ¶
The host package is responsible for gathering details about a given host.
Index ¶
Constants ¶
const ( DefaultMachineIDPath = "/etc/machine-id" DefaultProcRoot = "/proc" OSReleaseFilePath = "/etc/os-release" OSKernelFilePath = "sys/kernel/osrelease" CPUInfoFilePath = "cpuinfo" UnknownKey = "UNKNOWN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPUInfo ¶
type CPUInfo struct {
CPUCount int
}
CPUInfo represents details about the central processing unit.
type HostReader ¶
type HostReader interface { // GetOS retrieves operating-system details GetOS() (*OS, error) // GetKernel retrieves kernel details. GetKernel() (*Kernel, error) // GetHardware retrieves hardware-level details. Or, in the case of a virtual machine, what is // exposed to the guest. GetHardware() (*Hardware, error) // GetHostID retrieves a unique identifier that represents the host (physical/virtual machine). GetHostID() (string, error) }
HostReader defines the actions available for retrieving information about a host.
type LinuxReader ¶
type LinuxReader struct {
// contains filtered or unexported fields
}
LinuxReader is the Linux-specific implementation of HostReader.
func NewLinuxReader ¶
func NewLinuxReader(conf LinuxReaderConfig) LinuxReader
func (*LinuxReader) GetHardware ¶
func (h *LinuxReader) GetHardware() (*Hardware, error)
func (*LinuxReader) GetHostID ¶
func (h *LinuxReader) GetHostID() (string, error)
GetHostID provides a unique identifier representing the host. Today, it relies on [machine-id], which is created by Linux during installation. This functionality can be expanded over time to add methods for detecting the ID, when /etc/machine-id isn't possible or inadequate. If a ID is unable to be resolved, an error is returned.
func (*LinuxReader) GetKernel ¶
func (h *LinuxReader) GetKernel() (*Kernel, error)
GetKernel retrieves details about the kernel of the operating system.
func (*LinuxReader) GetOS ¶
func (h *LinuxReader) GetOS() (*OS, error)
GetOS looks up details about the operating system within /etc/os-release. We rely on details found inside os-release that comply with metadata found in the freedesktop specification.