Categorygithub.com/elastic/go-sysinfo
modulepackage
1.15.0
Repository: https://github.com/elastic/go-sysinfo.git
Documentation: pkg.go.dev

# README

go-sysinfo

go Go Documentation

go-sysinfo is a library for collecting system information. This includes information about the host machine and processes running on the host.

The available features vary based on what has been implemented by the "provider" for the operating system. At runtime you check to see if additional interfaces are implemented by the returned Host or Process. For example:

process, err := sysinfo.Self()
if err != nil {
	return err
}

if handleCounter, ok := process.(types.OpenHandleCounter); ok {
	count, err := handleCounter.OpenHandleCount()
	if err != nil {
		return err
	}
	log.Printf("%d open handles", count)
}

These tables show what methods are implemented as well as the extra interfaces that are implemented.

Host FeaturesDarwinLinuxWindowsAIX
Info()xxxx
Memory()xxxx
CPUTimerxxxx
LoadAveragexx
VMStatx
NetworkCountersx
Process FeaturesDarwinLinuxWindowsAIX
Info()xxxx
Memory()xxxx
User()xxxx
Parent()xxxx
CPUTimerxxxx
Environmentxxx
OpenHandleEnumeratorx
OpenHandleCounterx
Seccompx
Capabilitiesx
NetworkCountersx

GOOS / GOARCH Pairs

This table lists the OS and architectures for which a "provider" is implemented.

GOOS / GOARCHRequires CGOTested
aix/ppc64x
darwin/amd64optional *x
darwin/arm64optional *x
linux/386
linux/amd64x
linux/arm
linux/arm64
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
linux/ppc64
linux/ppc64le
linux/riscv64
linux/s390x
windows/amd64x
windows/arm64
windows/arm
  • On darwin (macOS) host information like machineid and process information like memory, cpu, user and starttime require cgo.

Supported Go versions

go-sysinfo supports the two most recent Go releases.

# Packages

No description provided by the author
No description provided by the author

# Functions

Go returns information about the Go runtime.
Host returns information about host on which this process is running.
Process returns a types.Process object representing the process associated with the given PID.
Processes return a list of all processes.
Self return a types.Process object representing this process.
WithHostFS returns a provider with a custom HostFS root path, enabling use of the library from within a container, or an alternate root path on linux.

# Type aliases

No description provided by the author