libvirt

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NO_FLAGS             = 0
	FETCH_DOMAINS_FLAGS  = lib.CONNECT_LIST_DOMAINS_ACTIVE | lib.CONNECT_LIST_DOMAINS_RUNNING
	MAX_NUM_MEMORY_STATS = 8
)
View Source
const LocalUri = "qemu:///system"

Variables

View Source
var DomainBlockXPath = xmlpath.MustCompile("/domain/devices/disk[@type=\"file\"]/target/@dev")
View Source
var DomainInterfaceXPath = xmlpath.MustCompile("/domain/devices/interface/target/@dev")

Functions

func NewBlockCollector

func NewBlockCollector(parent *vmCollector) *vmBlockCollector

func NewCpuCollector

func NewCpuCollector(parent *vmCollector) *cpuCollector

func NewInterfaceStatCollector

func NewInterfaceStatCollector(parent *vmCollector) *interfaceStatCollector

func NewMemoryCollector

func NewMemoryCollector(parent *vmCollector) *memoryStatCollector

func NewVmGeneralCollector

func NewVmGeneralCollector(parent *vmCollector) *vmGeneralCollector

func SshUri

func SshUri(host string, keyFile string) string

Types

type Collector

type Collector struct {
	collector.AbstractCollector
	// contains filtered or unexported fields
}

func NewLibvirtCollector

func NewLibvirtCollector(uri string, driver Driver, factory *collector.ValueRingFactory) *Collector

func (*Collector) Close

func (parent *Collector) Close()

func (*Collector) Init

func (parent *Collector) Init() ([]collector.Collector, error)

func (*Collector) MetricsChanged

func (parent *Collector) MetricsChanged() error

func (*Collector) Update

func (parent *Collector) Update() error

type Domain

type Domain interface {
	GetName() (string, error)
	GetXML() (string, error)
	GetInfo() (DomainInfo, error)

	CpuStats() (VirDomainCpuStats, error)
	BlockStats(dev string) (VirDomainBlockStats, error)
	BlockInfo(dev string) (VirDomainBlockInfo, error)
	MemoryStats() (VirDomainMemoryStat, error)
	InterfaceStats(interfaceName string) (VirDomainInterfaceStats, error)
}

type DomainImpl

type DomainImpl struct {
	// contains filtered or unexported fields
}

func (*DomainImpl) BlockInfo

func (d *DomainImpl) BlockInfo(dev string) (VirDomainBlockInfo, error)

func (*DomainImpl) BlockStats

func (d *DomainImpl) BlockStats(dev string) (VirDomainBlockStats, error)

func (*DomainImpl) CpuStats

func (d *DomainImpl) CpuStats() (VirDomainCpuStats, error)

func (*DomainImpl) GetInfo

func (d *DomainImpl) GetInfo() (res DomainInfo, err error)

func (*DomainImpl) GetName

func (d *DomainImpl) GetName() (string, error)

func (*DomainImpl) GetXML

func (d *DomainImpl) GetXML() (string, error)

func (*DomainImpl) InterfaceStats

func (d *DomainImpl) InterfaceStats(interfaceName string) (VirDomainInterfaceStats, error)

func (*DomainImpl) MemoryStats

func (d *DomainImpl) MemoryStats() (VirDomainMemoryStat, error)

type DomainInfo

type DomainInfo struct {
	CpuTime uint64
	MaxMem  uint64
	Mem     uint64
}

type Driver

type Driver interface {
	Connect(uri string) error
	ListDomains() ([]Domain, error)
	Close() error
}

func NewDriver

func NewDriver() Driver

type DriverImpl

type DriverImpl struct {
	// contains filtered or unexported fields
}

func (*DriverImpl) Close

func (d *DriverImpl) Close() (err error)

func (*DriverImpl) Connect

func (d *DriverImpl) Connect(uri string) error

func (*DriverImpl) ListDomains

func (d *DriverImpl) ListDomains() ([]Domain, error)

type LogbackCpuVal

type LogbackCpuVal uint64

func (LogbackCpuVal) AddValue

func (val LogbackCpuVal) AddValue(logback collector.LogbackValue) collector.LogbackValue

func (LogbackCpuVal) DiffValue

func (val LogbackCpuVal) DiffValue(logback collector.LogbackValue, interval time.Duration) bitflow.Value

func (LogbackCpuVal) GetValue

func (val LogbackCpuVal) GetValue() bitflow.Value

type VirDomainBlockInfo

type VirDomainBlockInfo struct {
	Allocation uint64
	Capacity   uint64
	Physical   uint64
}

type VirDomainBlockStats

type VirDomainBlockStats struct {
	RdReq   int64
	WrReq   int64
	RdBytes int64
	WrBytes int64
}

type VirDomainCpuStats

type VirDomainCpuStats struct {
	CpuTime    uint64
	UserTime   uint64
	SystemTime uint64
	VcpuTime   uint64
}

type VirDomainInterfaceStats

type VirDomainInterfaceStats struct {
	RxBytes   int64
	RxPackets int64
	RxErrs    int64
	RxDrop    int64
	TxBytes   int64
	TxPackets int64
	TxErrs    int64
	TxDrop    int64
}

type VirDomainMemoryStat

type VirDomainMemoryStat struct {
	Available uint64
	Unused    uint64
}

Jump to

Keyboard shortcuts

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