Git Product home page Git Product logo

go-sysinfo's Introduction

go-sysinfo

Build Status Github Workflow 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 Features Darwin Linux Windows AIX
Info() x x x x
Memory() x x x x
CPUTimer x x x x
LoadAverage x x
VMStat x
NetworkCounters x
Process Features Darwin Linux Windows AIX
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

GOOS / GOARCH Pairs

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

GOOS / GOARCH Requires CGO Tested
aix/ppc64 x
darwin/amd64 optional * x
darwin/arm64 optional * x
linux/386
linux/amd64 x
linux/arm
linux/arm64
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
linux/ppc64
linux/ppc64le
linux/riscv64
linux/s390x
windows/amd64 x
windows/arm64
windows/arm
  • On darwin (macOS) host information like machineid and process information like memory, cpu, user and starttime require cgo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.