Documentation
¶
Overview ¶
Package hoststat reads host-level CPU, memory and disk usage from /proc and the filesystem. It has no dependencies on the rest of the codebase so both the server's resource service and the remote agent collector can use it.
Index ¶
Constants ¶
const ( OSSourceHostFile = "host_file" OSSourceKubernetesNode = "kubernetes_node" )
Source values of an OSRelease.
const ( OSReasonMountMissing = "mount_missing" OSReasonFileUnreadable = "file_unreadable" OSReasonNodeNotFound = "node_not_found" )
Reasons why an OSRelease carries no identity.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OSRelease ¶ added in v1.7.0
OSRelease identifies the operating system of a host.
func ParseOSImage ¶ added in v1.7.0
ParseOSImage derives an operating system identity from a Kubernetes node osImage string. An unrecognised string keeps its pretty name and no version.
func ReadOSRelease ¶ added in v1.7.0
func ReadOSRelease() OSRelease
ReadOSRelease returns the host operating system identity, or the reason it could not be read.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader samples host CPU and memory at 1s intervals via /proc. It runs its own goroutine, independent of any container collector.
func NewReader ¶
func NewReader() *Reader
NewReader creates a reader and takes an initial CPU sample.
func (*Reader) CPUPercent ¶
CPUPercent returns the latest host CPU usage percentage (0-100).