systeminfo

package module
v0.0.0-...-ce9c855 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: MIT Imports: 11 Imported by: 2

README

systeminfo

GoDocBuild Status

Information about a system: Sockets, RAM, network interfaces, OS, Kernel. This only works on Linux, for now.

Only basic information about a system is gathered. For more detailed informatino about different aspects of a system, use the relevant JoeFriday packages.

Convenience functions are provided for Marshaling and Unmarshaling the data using either JSON or ProtoBuf serialization.

Supported output

  • Go struct
  • JSON
  • Protocol Buffers
  • Flatbuffers

Notes

If using the flatbuffers implementation, the package name is still systeminfo even though the import path is github.com/mohae/systeminfo/flat. If one is also using the github.com/mohae/systeminfo.System struct one of the packages will need to be aliased.

TODO

Add disk information.
Add support for other platforms.

Documentation

Overview

Package systeminfo is a generated protocol buffer package.

It is generated from these files:

system.proto

It has these top-level messages:

System
CPU

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthSystem = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSystem   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type CPU

type CPU struct {
	PhysicalID int32    `protobuf:"varint,1,opt,name=PhysicalID,proto3" json:"PhysicalID,omitempty"`
	CoreID     int32    `protobuf:"varint,2,opt,name=CoreID,proto3" json:"CoreID,omitempty"`
	Siblings   int32    `protobuf:"varint,3,opt,name=Siblings,proto3" json:"Siblings,omitempty"`
	VendorID   string   `protobuf:"bytes,4,opt,name=VendorID,proto3" json:"VendorID,omitempty"`
	CPUFamily  string   `protobuf:"bytes,5,opt,name=CPUFamily,proto3" json:"CPUFamily,omitempty"`
	Model      string   `protobuf:"bytes,6,opt,name=Model,proto3" json:"Model,omitempty"`
	ModelName  string   `protobuf:"bytes,7,opt,name=ModelName,proto3" json:"ModelName,omitempty"`
	Stepping   string   `protobuf:"bytes,8,opt,name=Stepping,proto3" json:"Stepping,omitempty"`
	Microcode  string   `protobuf:"bytes,9,opt,name=Microcode,proto3" json:"Microcode,omitempty"`
	CPUMHz     float32  `protobuf:"fixed32,10,opt,name=CPUMHz,proto3" json:"CPUMHz,omitempty"`
	BogoMIPS   float32  `protobuf:"fixed32,11,opt,name=BogoMIPS,proto3" json:"BogoMIPS,omitempty"`
	CacheSize  string   `protobuf:"bytes,12,opt,name=CacheSize,proto3" json:"CacheSize,omitempty"`
	CPUCores   int32    `protobuf:"varint,13,opt,name=CPUCores,proto3" json:"CPUCores,omitempty"`
	Flags      []string `protobuf:"bytes,14,rep,name=Flags" json:"Flags,omitempty"`
	Bugs       []string `protobuf:"bytes,15,rep,name=Bugs" json:"Bugs,omitempty"`
}

func (*CPU) Descriptor

func (*CPU) Descriptor() ([]byte, []int)

func (*CPU) GetBogoMIPS

func (m *CPU) GetBogoMIPS() float32

func (*CPU) GetBugs

func (m *CPU) GetBugs() []string

func (*CPU) GetCPUCores

func (m *CPU) GetCPUCores() int32

func (*CPU) GetCPUFamily

func (m *CPU) GetCPUFamily() string

func (*CPU) GetCPUMHz

func (m *CPU) GetCPUMHz() float32

func (*CPU) GetCacheSize

func (m *CPU) GetCacheSize() string

func (*CPU) GetCoreID

func (m *CPU) GetCoreID() int32

func (*CPU) GetFlags

func (m *CPU) GetFlags() []string

func (*CPU) GetMicrocode

func (m *CPU) GetMicrocode() string

func (*CPU) GetModel

func (m *CPU) GetModel() string

func (*CPU) GetModelName

func (m *CPU) GetModelName() string

func (*CPU) GetPhysicalID

func (m *CPU) GetPhysicalID() int32

func (*CPU) GetSiblings

func (m *CPU) GetSiblings() int32

func (*CPU) GetStepping

func (m *CPU) GetStepping() string

func (*CPU) GetVendorID

func (m *CPU) GetVendorID() string

func (*CPU) Marshal

func (m *CPU) Marshal() (dAtA []byte, err error)

func (*CPU) MarshalTo

func (m *CPU) MarshalTo(dAtA []byte) (int, error)

func (*CPU) ProtoMessage

func (*CPU) ProtoMessage()

func (*CPU) Reset

func (m *CPU) Reset()

func (*CPU) Size

func (m *CPU) Size() (n int)

func (*CPU) String

func (m *CPU) String() string

func (*CPU) Unmarshal

func (m *CPU) Unmarshal(dAtA []byte) error

type Error

type Error struct {
	Op  string
	Err error
}

func (Error) Error

func (e Error) Error() string

type System

type System struct {
	Hostname          string   `protobuf:"bytes,1,opt,name=Hostname,proto3" json:"Hostname,omitempty"`
	KernelOS          string   `protobuf:"bytes,2,opt,name=KernelOS,proto3" json:"KernelOS,omitempty"`
	KernelVersion     string   `protobuf:"bytes,3,opt,name=KernelVersion,proto3" json:"KernelVersion,omitempty"`
	KernelArch        string   `protobuf:"bytes,4,opt,name=KernelArch,proto3" json:"KernelArch,omitempty"`
	KernelType        string   `protobuf:"bytes,5,opt,name=KernelType,proto3" json:"KernelType,omitempty"`
	KernelCompileDate string   `protobuf:"bytes,6,opt,name=KernelCompileDate,proto3" json:"KernelCompileDate,omitempty"`
	OSName            string   `protobuf:"bytes,7,opt,name=OSName,proto3" json:"OSName,omitempty"`
	OSID              string   `protobuf:"bytes,8,opt,name=OSID,proto3" json:"OSID,omitempty"`
	OSIDLike          string   `protobuf:"bytes,9,opt,name=OSIDLike,proto3" json:"OSIDLike,omitempty"`
	OSVersion         string   `protobuf:"bytes,10,opt,name=OSVersion,proto3" json:"OSVersion,omitempty"`
	MemTotal          uint64   `protobuf:"varint,11,opt,name=MemTotal,proto3" json:"MemTotal,omitempty"`
	SwapTotal         uint64   `protobuf:"varint,12,opt,name=SwapTotal,proto3" json:"SwapTotal,omitempty"`
	NetDev            []string `protobuf:"bytes,13,rep,name=NetDev" json:"NetDev,omitempty"`
	Sockets           int32    `protobuf:"varint,14,opt,name=Sockets,proto3" json:"Sockets,omitempty"`
	CPU               []*CPU   `protobuf:"bytes,15,rep,name=CPU" json:"CPU,omitempty"`
}

func JSONUnmarshal

func JSONUnmarshal(p []byte) (s *System, err error)

JSONUnmarshal unmarshals the received bytes into System.

func ProtoUnmarshal

func ProtoUnmarshal(p []byte) (s *System, err error)

ProtoUnmarshal unmarshals the received bytes into System.

func (*System) Descriptor

func (*System) Descriptor() ([]byte, []int)

func (*System) Get

func (s *System) Get() error

func (*System) GetCPU

func (m *System) GetCPU() []*CPU

func (*System) GetHostname

func (m *System) GetHostname() string

func (*System) GetKernelArch

func (m *System) GetKernelArch() string

func (*System) GetKernelCompileDate

func (m *System) GetKernelCompileDate() string

func (*System) GetKernelOS

func (m *System) GetKernelOS() string

func (*System) GetKernelType

func (m *System) GetKernelType() string

func (*System) GetKernelVersion

func (m *System) GetKernelVersion() string

func (*System) GetMemTotal

func (m *System) GetMemTotal() uint64

func (*System) GetNetDev

func (m *System) GetNetDev() []string

func (*System) GetOSID

func (m *System) GetOSID() string

func (*System) GetOSIDLike

func (m *System) GetOSIDLike() string

func (*System) GetOSName

func (m *System) GetOSName() string

func (*System) GetOSVersion

func (m *System) GetOSVersion() string

func (*System) GetSockets

func (m *System) GetSockets() int32

func (*System) GetSwapTotal

func (m *System) GetSwapTotal() uint64

func (*System) JSONMarshal

func (s *System) JSONMarshal() (p []byte, err error)

JSONMarshal marshals the System info as JSON and returns the result.

func (*System) Marshal

func (m *System) Marshal() (dAtA []byte, err error)

func (*System) MarshalTo

func (m *System) MarshalTo(dAtA []byte) (int, error)

func (*System) ProtoMarshal

func (s *System) ProtoMarshal() (p []byte, err error)

ProtoMarshal marshals the System info as Protobuf and returns the result.

func (*System) ProtoMessage

func (*System) ProtoMessage()

func (*System) Reset

func (m *System) Reset()

func (*System) Size

func (m *System) Size() (n int)

func (*System) String

func (m *System) String() string

func (*System) Unmarshal

func (m *System) Unmarshal(dAtA []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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