dmidecode

package module
v0.0.0-...-886eea1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

README

golang dmidecode

part of golang console

依赖 doggytty/goutils go get -u github.com/doggytty/goutils

支持用户: root/sudo user

命令:

dmidecode -t bios

dmidecode -t system

dmidecode -t baseboard

dmidecode -t chassis

dmidecode -t processor

dmidecode -t memory

dmidecode -t cache

dmidecode -t connector

dmidecode -t slot

备注

测试环境linux/amd64(ubuntu 16.04 LTS)

Documentation

Index

Constants

View Source
const DEBUG = true

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseBoardInfo

type BaseBoardInfo struct {
	//Manufacturer: LENOVO
	Manufacturer string
	//Product Name: 20ASEB3
	ProductName string
	//Version: No DPK
	Version string
	//Serial Number: ZZ0R958AGF4
	SerialNumber string
	//Asset Tag: Not Available
	AssertTag string
	//Features:
	//Board is a hosting board
	//Board is replaceable
	Features []string
	//Location In Chassis: Not Available
	LocationInChassis string
	//Chassis Handle: 0x0000
	ChassisHandle string
	//Type: Motherboard
	Type string
	//Contained Object Handles: 0
	ContainedObjectHandles string
}

dmidecode -t baseboard

type BiosInfo

type BiosInfo struct {
	//Vendor: LENOVO
	Vendor string
	//Version: J4ET76WW(1.76)
	Version string
	//Address: 0xE0000
	Address string
	//BIOS Revision: 1.76
	BIOSRevision string
	//Release Date: 03/03/2015
	ReleaseDate string
	//Runtime Size: 128 kB
	RuntimeSize string
	//ROM Size: 8192 kB
	RomSize string
	//Characteristics:
	Characteristics []string
}

dmidecode -t bios

type BiosLanguage

type BiosLanguage struct {
	//Language Description Format: Abbreviated
	LanguageDescriptionFormat string
	//Installable Languages: 7
	InstallableLanguagesNumber int
	InstallableLanguages       []string
	//Currently Installed Language: en-US
	CurrentlyInstalledLanguage string
}

type CacheInfo

type CacheInfo struct {
	//Socket Designation: L2-Cache
	SocketDesignation string
	//Configuration: Enabled, Not Socketed, Level 2
	Configuration string
	//Operational Mode: Write Back
	OperationalMode string
	//Location: Internal
	Location string
	//Installed Size: 256 kB
	InstalledSize string
	//Maximum Size: 256 kB
	MaximumSize string
	//Supported SRAM Types:
	SupportedSRAMTypes []string
	//Asynchronous
	//Installed SRAM Type: Asynchronous
	InstalledSRAMType string
	//Speed: Unknown
	Speed string
	//Error Correction Type: Single-bit ECC
	ErrorCorrectionType string
	//System Type: Unified
	SystemType string
	//Associativity: 8-way Set-associative
	Associativity string
}

dmidecode -t cache

type ChassisInfo

type ChassisInfo struct {
	//Manufacturer: LENOVO
	Manufacturer string
	//Type: Notebook
	Type string
	//Lock: Not Present
	Lock string
	//Version: Not Available
	Version string
	//Serial Number: ZZ0R958AGF4
	SerialNumber string
	//Asset Tag: Not Available
	AssertTag string
	//Boot-up State: Unknown
	BootUpState string
	//Power Supply State: Unknown
	PowerSupplyState string
	//Thermal State: Unknown
	ThermalState string
	//Security Status: Unknown
	SecurityStatus string
	//OEM Information: 0x00000000
	OEMInformation string
	//Height: Unspecified
	Height string
	//Number Of Power Cords: Unspecified
	NumberOfPowerCords string
	//Contained Elements: 0
	ContainedElements string
	//SKU Number: Not Specified
	SKUNumber string
}

dmidecode -t chassis

type DmiDecode

type DmiDecode struct {
	Path     string // dmidecode的安装路径
	LastErr  error  // 错误信息
	IsRoot   bool   // 是否root用户启动
	IsActive bool   // 是否可用
	Password string // 使用sudo执行命令需要传入的password
}

func Instance

func Instance() *DmiDecode

func (*DmiDecode) QueryBIOS

func (d *DmiDecode) QueryBIOS() (*BiosInfo, *BiosLanguage, error)

func (*DmiDecode) QueryBaseBoard

func (d *DmiDecode) QueryBaseBoard() (*BaseBoardInfo, error)

func (*DmiDecode) QueryCache

func (d *DmiDecode) QueryCache() ([]*CacheInfo, error)

func (*DmiDecode) QueryChassis

func (d *DmiDecode) QueryChassis() (*ChassisInfo, error)

func (*DmiDecode) QueryConnector

func (d *DmiDecode) QueryConnector() ([]*PortConnectorInfo, error)

func (*DmiDecode) QueryMemory

func (d *DmiDecode) QueryMemory() (*MemoryInfo, error)

func (*DmiDecode) QueryProcessor

func (d *DmiDecode) QueryProcessor() (*ProcessorInfo, error)

func (*DmiDecode) QuerySlot

func (d *DmiDecode) QuerySlot() ([]*SystemSlotInfo, error)

func (*DmiDecode) QuerySystem

func (d *DmiDecode) QuerySystem() (*SystemInfo, error)

func (*DmiDecode) SetPassword

func (d *DmiDecode) SetPassword(password string)

type MemoryDevice

type MemoryDevice struct {
	//Array Handle: 0x0005
	ArrayHandle string
	//Error Information Handle: Not Provided
	ErrorInformationHandle string
	//Total Width: 64 bits
	TotalWidth string
	//Data Width: 64 bits
	DataWidth string
	// Size: 4096 MB
	Size string
	//Form Factor: SODIMM
	FormFactor string
	//Set: None
	Set string
	//Locator: ChannelB-DIMM0
	Locator string
	//Bank Locator: BANK 2
	BankLocator string
	//Type: DDR3
	Type string
	//Type Detail: Synchronous
	TypeDetail string
	//Speed: 1600 MHz
	Speed string
	//Manufacturer: Hynix/Hyundai
	Manufacturer string
	//Serial Number: 1A6266B1
	SerialNumber string
	//Asset Tag: 9876543210
	AssetTag string
	//Part Number: HMT451S6AFR8A-PB
	PartNumber string
	//Rank: Unknown
	Rank string
	//Configured Clock Speed: 1600 MHz
	ConfiguredClockSpeed string
}

type MemoryInfo

type MemoryInfo struct {
	//Location: System Board Or Motherboard
	Location string
	//Use: System Memory
	Use string
	//Error Correction Type: None
	ErrorCorrectionType string
	//Maximum Capacity: 16 GB
	MaximumCapacity string
	//Error Information Handle: Not Provided
	ErrorInformationHandle string
	//Number Of Devices: 2
	NumberOfDevices string
	MemoryList      []*MemoryDevice
}

dmidecode -t memory

type PortConnectorInfo

type PortConnectorInfo struct {
	//Internal Reference Designator: Not Available
	InternalReferenceDesignator string
	//Internal Connector Type: None
	InternalConnectorType string
	//External Reference Designator: External Monitor
	ExternalReferenceDesignator string
	//External Connector Type: DB-15 female
	ExternalConnectorType string
	//Port Type: Video Port
	PortType string
}

dmidecode -t connector

type ProcessorInfo

type ProcessorInfo struct {
	//Socket Designation: CPU Socket - U3E1
	SocketDesignation string
	//Type: Central Processor
	Type string
	//Family: Core i7
	Family string
	//Manufacturer: Intel(R) Corporation
	Manufacturer string
	//ID: C3 06 03 00 FF FB EB BF
	ID string
	//Signature: Type 0, Family 6, Model 60, Stepping 3
	Signature string
	//Flags
	Flags []string
	//Version: Intel(R) Core(TM) i7-4712MQ CPU @ 2.30GHz
	Version string
	//Voltage: 0.7 V
	Voltage string
	//External Clock: 100 MHz
	ExternalClock string
	//Max Speed: 2300 MHz
	MaxSpeed string
	//Current Speed: 2300 MHz
	CurrentSpeed string
	//Status: Populated, Enabled
	Status string
	//Upgrade: Socket rPGA988B
	Upgrade string
	//L1 Cache Handle: 0x0002
	L1CacheHandle string
	L2CacheHandle string
	L3CacheHandle string
	//Serial Number: To Be Filled By O.E.M.
	SerialNumber string
	//Asset Tag: To Be Filled By O.E.M.
	AssetTag string
	//Part Number: To Be Filled By O.E.M.
	PartNumber string
	//Core Count: 4
	CoreCount string
	//Core Enabled: 4
	CoreEnabled string
	//Thread Count: 8
	ThreadCount string
	//Characteristics:
	Characteristics []string
}

dmidecode -t processor

type SystemInfo

type SystemInfo struct {
	Manufacturer string
	ProductName  string
	Version      string
	SerialNumber string
	UUID         string
	WakeUpType   string
	SKUNumber    string
	Family       string
}

dmidecode -t system

type SystemSlotInfo

type SystemSlotInfo struct {
	//Designation: ExpressCard Slot
	Designation string
	//Type: x1 PCI Express
	Type string
	//Current Usage: Available
	CurrentUsage string
	//Length: Other
	Length string
	//ID: 1
	ID string
	//Characteristics:Hot-plug devices are supported
	Characteristics []string
	//Bus Address: 0000:00:00.0
	BusAddress string
}

dmidecode -t slot

Jump to

Keyboard shortcuts

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