host

package
v0.0.0-...-3a64f8a Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const NoNUMA = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type CPU

type CPU struct {
	Type     string
	Capacity float64
	Clock    float64
	Config   map[string]interface{}
	Cap      map[string]interface{}
}

CPU contains CPU description and properties

type Collector

type Collector struct {
	Run func(string) (string, error)
	// contains filtered or unexported fields
}

func NewCollector

func NewCollector(sshconf *ssh.Config, lshwpath, hwinfoFile string) (*Collector, error)

NewCollector constructs new lshw Collector The output will be represented in JSON format

func (*Collector) CPUInfo

func (c *Collector) CPUInfo() (*CPU, error)

CPUInfo gathers information related to installed CPUs

func (*Collector) CPUs

func (c *Collector) CPUs() (int, error)

func (*Collector) Hwinfo2Json

func (c *Collector) Hwinfo2Json() error

Parse parses lshw output

func (*Collector) NICInfo

func (c *Collector) NICInfo() (NICList, error)

NICInfo gathers information related to installed NICs

func (*Collector) NUMANodes

func (c *Collector) NUMANodes() (NUMANodes, error)

func (*Collector) RAMSize

func (c *Collector) RAMSize() (int, error)

RAMSize gathers information related to the installed amount of RAM in MB

type NIC

type NIC struct {
	// port name (eth0,br0...)
	Name string

	// NIC driver(bridge,openvswitch...)
	Driver string

	// Vendor
	Vendor string

	// Model
	Model string

	// PCI Address
	PCIAddr string

	// NUMA Node
	NUMANode int

	// Description
	Desc string

	// Port type
	Type NicType
}

NIC information

type NICList

type NICList []*NIC

func NewNICList

func NewNICList() NICList

func (*NICList) Add

func (list *NICList) Add(nics ...*NIC)

func (*NICList) AppendList

func (list *NICList) AppendList(l NICList)

func (NICList) IndexByName

func (list NICList) IndexByName(name string) (int, error)

func (NICList) IndexByObj

func (list NICList) IndexByObj(n *NIC) (int, error)

func (NICList) IndexByPCI

func (list NICList) IndexByPCI(pciaddr string) (int, error)

func (NICList) Length

func (list NICList) Length() int

func (*NICList) Remove

func (list *NICList) Remove(index int)

func (NICList) SortByName

func (list NICList) SortByName()

func (NICList) SortByPCI

func (list NICList) SortByPCI()

type NUMA

type NUMA struct {
	CellID   int
	TotalRAM int
	FreeRAM  int
	CPUs     []int
}

type NUMANodes

type NUMANodes []*NUMA

func (NUMANodes) CpusOnNUMA

func (n NUMANodes) CpusOnNUMA(cellID int) ([]int, error)

CpusOnNUMA returns a slice of CPUs bound to the given NUMA node

func (NUMANodes) NUMAByCellID

func (n NUMANodes) NUMAByCellID(cellID int) *NUMA

func (NUMANodes) TotalCPUs

func (n NUMANodes) TotalCPUs() int

TotalCPUs returns amount of CPUs on all NUMAs

func (NUMANodes) TotalNUMAs

func (n NUMANodes) TotalNUMAs() int

TotalNUMAs returns amount of NUMA nodes installed on the host

type NicType

type NicType string

supported NIC types

const (
	NicTypePhys           NicType = "physical"
	NicTypePhysVF         NicType = "virtualfunc"
	NicTypeOVS            NicType = "openvswitch"
	NicTypeBridge         NicType = "bridge"
	NicTypeVirtualNetwork NicType = "virtnetwork"
)

type SortByName

type SortByName NICList

func (SortByName) Len

func (list SortByName) Len() int

func (SortByName) Less

func (list SortByName) Less(i, j int) bool

func (SortByName) Swap

func (list SortByName) Swap(i, j int)

type SortByPCI

type SortByPCI NICList

func (SortByPCI) Len

func (list SortByPCI) Len() int

func (SortByPCI) Less

func (list SortByPCI) Less(i, j int) bool

func (SortByPCI) Swap

func (list SortByPCI) Swap(i, j int)

Jump to

Keyboard shortcuts

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