sysinfo

package module
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

go-sysinfo

Build Status Go Documentation

NOTE: THIS IS A FORK FOR PERSONAL USE -V

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 Features Darwin Linux Windows AIX/ppc64
Info() x x x x
Memory() x x x x
CPUTimer x x x x
VMStat x
NetworkCounters x
Process Features Darwin Linux Windows AIX/ppc64
Info() x x x x
Memory() x x x x
User() x x x x
Parent() x x x x
CPUTimer x x x x
Environment x x x
OpenHandleEnumerator x
OpenHandleCounter x
Seccomp x
Capabilities x
NetworkCounters x

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go

func Go() types.GoInfo

Go returns information about the Go runtime.

func Host

func Host() (types.Host, error)

Host returns information about host on which this process is running. If host information collection is not implemented for this platform then types.ErrNotImplemented is returned.

func Process

func Process(pid int) (types.Process, error)

Process returns a types.Process object representing the process associated with the given PID. The types.Process object can be used to query information about the process. If process information collection is not implemented for this platform then types.ErrNotImplemented is returned.

func Processes

func Processes() ([]types.Process, error)

Processes return a list of all processes. If process information collection is not implemented for this platform then types.ErrNotImplemented is returned.

func Self

func Self() (types.Process, error)

Self return a types.Process object representing this process. If process information collection is not implemented for this platform then types.ErrNotImplemented is returned.

Types

This section is empty.

Directories

Path Synopsis
internal
providers
aix
Package aix implements the HostProvider and ProcessProvider interfaces for providing information about MacOS.
Package aix implements the HostProvider and ProcessProvider interfaces for providing information about MacOS.
darwin
Package darwin implements the HostProvider and ProcessProvider interfaces for providing information about MacOS.
Package darwin implements the HostProvider and ProcessProvider interfaces for providing information about MacOS.
linux
Package linux implements the HostProvider and ProcessProvider interfaces for providing information about Linux.
Package linux implements the HostProvider and ProcessProvider interfaces for providing information about Linux.
windows
Package windows implements the HostProvider and ProcessProvider interfaces for providing information about Windows.
Package windows implements the HostProvider and ProcessProvider interfaces for providing information about Windows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL