Documentation
¶
Overview ¶
Package host provides the host information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DmidecodeUUID ¶ added in v0.3.5
Fetches the UUIF of the machine host, using the "dmidecode". Returns an empty string if the UUID is not found.
ref. UUID=$(dmidecode -t 1 | grep -i UUID | awk '{print $2}')
func GetMachineID ¶ added in v0.3.5
Returns the UUID of the machine host. Returns an empty string if the UUID is not found.
func GetOSMachineID ¶ added in v0.3.5
Returns the OS-level UUID based on /etc/machine-id or /var/lib/dbus/machine-id. Returns an empty string if the UUID is not found.
Types ¶
type VirtualizationEnvironment ¶ added in v0.3.5
type VirtualizationEnvironment struct {
// Type is the virtualization type.
// Output of "systemd-detect-virt".
// e.g., "kvm" for VM, "lxc" for container
Type string `json:"type"`
// Whether the host is running in a VM.
// Output of "systemd-detect-virt --vm".
// Set to "none" if the host is not running in a VM.
// e.g., "kvm"
VM string `json:"vm"`
// Whether the host is running in a container.
// Output of "systemd-detect-virt --container".
// Set to "none" if the host is not running in a container.
// e.g., "lxc"
Container string `json:"container"`
// Whether the host is running in a KVM.
// Set to "false" if the host is not running in a KVM.
IsKVM bool `json:"is_kvm"`
}
VirtualizationEnvironment represents the virtualization environment of the host.
func SystemdDetectVirt ¶ added in v0.3.5
func SystemdDetectVirt(ctx context.Context) (VirtualizationEnvironment, error)
SystemdDetectVirt detects the virtualization type of the host, using "systemd-detect-virt".
Click to show internal directories.
Click to hide internal directories.