Documentation
¶
Overview ¶
Package host reads the facts of the host, such as its hostname, its OS and its uptime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gohai ¶ added in v0.3.0
type Gohai struct {
// Sources are what the collectors read. A zero field is the real
// host's.
Sources source.Sources
}
Gohai reads the host's name, OS and uptime with gohai's collectors, on every Linux family and on macOS.
func (*Gohai) GetHostname ¶ added in v0.3.0
GetHostname is the host's name, as `hostname` prints it.
type Provider ¶
type Provider interface {
// GetUptime retrieves the system uptime.
GetUptime() (time.Duration, error)
// GetHostname retrieves the hostname of the system.
GetHostname() (string, error)
// GetOSInfo retrieves information about the operating system, including the
// distribution name and version.
GetOSInfo() (*Result, error)
}
Provider implements the methods to interact with various Host components.
type Result ¶
type Result struct {
// The name of the Linux distribution (e.g., Debian, CentOS).
Distribution string
// The version of the Linux distribution (e.g., 20.04, 8.3).
Version string
// Family is the platform family that the agent resolves providers by, as
// gohai's family.Detect names it (e.g., debian, suse, darwin).
Family string
// Changed indicates whether system state was modified.
Changed bool `json:"changed"`
}
Result represents the operating system information.