hwinfo

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

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

Go to latest
Published: Jul 21, 2017 License: MIT Imports: 7 Imported by: 3

README

PURPOSE

This lib is used to get hardware info like model, serial, connectivity, status,... of Motherboard, CPU, RAM, HDD, NIC, v.v..

This lib is not intended to be "beautiful", we don't use a single methodology to get informations. We will use multi methods to read information to experimental and practicing.

PS: it could be beautified when we feel comfortable and think it's necessary.

Documentation

Index

Constants

View Source
const CPU_INFO_FILE = "/proc/cpuinfo"

Read file /proc/cpuinfo, then parse it line by line. Read line have info we need and bypass line have info we don't need. Count CPU quantity and vcores number.

View Source
const MB_NAME_FILE = "/sys/devices/virtual/dmi/id/board_name"

Read from /sys/devices/virtual/dmi/id/board_{name,serial,vendor}

View Source
const MB_SERIAL_FILE = "/sys/devices/virtual/dmi/id/board_serial"
View Source
const MB_VENDOR_FILE = "/sys/devices/virtual/dmi/id/board_vendor"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChassisStats

type ChassisStats struct {
	Manufacturer string
	SerialNumber string
}

func Get_chassis

func Get_chassis() (Chassis ChassisStats, err error)

type Cpustats

type Cpustats struct {
	Model      string
	Quantity   int
	Totalcores int
}

func Get_cpu

func Get_cpu() (Cpu Cpustats, err error)

type HddStats

type HddStats struct {
	Items []HddType
}

func Get_hdd

func Get_hdd() (Hdd HddStats, err error)

type HddType

type HddType struct {
	Model        string
	SerialNumber string
	Firmware     string
	Size         string
	DevName      string
	//Type         string  // currently, i don't have precise method to determine SSD, SAS, SATA,..
	Bus string // ide, ata, scsi
}

type MBstats

type MBstats struct {
	Model        string
	SerialNumber string
}
var Motherboard MBstats

func Get_motherboard

func Get_motherboard() (Motherboard MBstats, err error)

type NicStats

type NicStats struct {
	Items []NicType
}

func Get_nic

func Get_nic() (Nic NicStats, err error)

type NicType

type NicType struct {
	IfName string
	MAC    string
}

type Ramstats

type Ramstats struct {
	TotalCapacity string
	Items         []Ramtype
}

func Get_ram

func Get_ram() (Ram Ramstats, err error)

type Ramtype

type Ramtype struct {
	Size         string
	BankLocator  string
	ClockSpeed   string
	Manufacturer string
	SerialNumber string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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