sysinfo: Index | Examples | Files | Directories

package sysinfo

import ""

Package sysinfo is a Go library providing Linux OS / kernel / hardware system information.


var si sysinfo.SysInfo


data, err := json.MarshalIndent(&si, "", "  ")
if err != nil {




Package Files

bios.go board.go chassis.go cpu.go hypervisor.go kernel.go memory.go meta.go network.go node.go os.go product.go storage.go sysinfo.go util.go version.go


const Version = "0.9.3"

Version of the sysinfo library.


var ErrNotExist = errors.New("SMBIOS entry point not found")

ErrNotExist indicates that SMBIOS entry point could not be found.

type BIOS Uses

type BIOS struct {
    Vendor  string `json:"vendor,omitempty"`
    Version string `json:"version,omitempty"`
    Date    string `json:"date,omitempty"`

BIOS information.

type Board Uses

type Board struct {
    Name     string `json:"name,omitempty"`
    Vendor   string `json:"vendor,omitempty"`
    Version  string `json:"version,omitempty"`
    Serial   string `json:"serial,omitempty"`
    AssetTag string `json:"assettag,omitempty"`

Board information.

type CPU Uses

type CPU struct {
    Vendor  string `json:"vendor,omitempty"`
    Model   string `json:"model,omitempty"`
    Speed   uint   `json:"speed,omitempty"`   // CPU clock rate in MHz
    Cache   uint   `json:"cache,omitempty"`   // CPU cache size in KB
    Cpus    uint   `json:"cpus,omitempty"`    // number of physical CPUs
    Cores   uint   `json:"cores,omitempty"`   // number of physical CPU cores
    Threads uint   `json:"threads,omitempty"` // number of logical (HT) CPU cores

CPU information.

type Chassis Uses

type Chassis struct {
    Type     uint   `json:"type,omitempty"`
    Vendor   string `json:"vendor,omitempty"`
    Version  string `json:"version,omitempty"`
    Serial   string `json:"serial,omitempty"`
    AssetTag string `json:"assettag,omitempty"`

Chassis information.

type Kernel Uses

type Kernel struct {
    Release      string `json:"release,omitempty"`
    Version      string `json:"version,omitempty"`
    Architecture string `json:"architecture,omitempty"`

Kernel information.

type Memory Uses

type Memory struct {
    Type  string `json:"type,omitempty"`
    Speed uint   `json:"speed,omitempty"` // RAM data rate in MT/s
    Size  uint   `json:"size,omitempty"`  // RAM size in MB

Memory information.

type Meta Uses

type Meta struct {
    Version   string    `json:"version"`
    Timestamp time.Time `json:"timestamp"`

Meta information.

type NetworkDevice Uses

type NetworkDevice struct {
    Name       string `json:"name,omitempty"`
    Driver     string `json:"driver,omitempty"`
    MACAddress string `json:"macaddress,omitempty"`
    Port       string `json:"port,omitempty"`
    Speed      uint   `json:"speed,omitempty"` // device max supported speed in Mbps

NetworkDevice information.

type Node Uses

type Node struct {
    Hostname   string `json:"hostname,omitempty"`
    MachineID  string `json:"machineid,omitempty"`
    Hypervisor string `json:"hypervisor,omitempty"`
    Timezone   string `json:"timezone,omitempty"`

Node information.

type OS Uses

type OS struct {
    Name         string `json:"name,omitempty"`
    Vendor       string `json:"vendor,omitempty"`
    Version      string `json:"version,omitempty"`
    Release      string `json:"release,omitempty"`
    Architecture string `json:"architecture,omitempty"`

OS information.

type Product Uses

type Product struct {
    Name    string `json:"name,omitempty"`
    Vendor  string `json:"vendor,omitempty"`
    Version string `json:"version,omitempty"`
    Serial  string `json:"serial,omitempty"`

Product information.

type StorageDevice Uses

type StorageDevice struct {
    Name   string `json:"name,omitempty"`
    Driver string `json:"driver,omitempty"`
    Vendor string `json:"vendor,omitempty"`
    Model  string `json:"model,omitempty"`
    Serial string `json:"serial,omitempty"`
    Size   uint   `json:"size,omitempty"` // device size in GB

StorageDevice information.

type SysInfo Uses

type SysInfo struct {
    Meta    Meta            `json:"sysinfo"`
    Node    Node            `json:"node"`
    OS      OS              `json:"os"`
    Kernel  Kernel          `json:"kernel"`
    Product Product         `json:"product"`
    Board   Board           `json:"board"`
    Chassis Chassis         `json:"chassis"`
    BIOS    BIOS            `json:"bios"`
    CPU     CPU             `json:"cpu"`
    Memory  Memory          `json:"memory"`
    Storage []StorageDevice `json:"storage,omitempty"`
    Network []NetworkDevice `json:"network,omitempty"`

SysInfo struct encapsulates all other information structs.

func (*SysInfo) GetSysInfo Uses

func (si *SysInfo) GetSysInfo()

GetSysInfo gathers all available system information.


cpuidPackage cpuid gives Go programs access to CPUID opcode.

Package sysinfo imports 17 packages (graph) and is imported by 2 packages. Updated 2020-02-28. Refresh now. Tools for package owners.