libvirt

package
v0.0.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NoFlags           = 0
	FetchDomainsFlags = lib.CONNECT_LIST_DOMAINS_ACTIVE | lib.CONNECT_LIST_DOMAINS_RUNNING
	MaxNumMemoryStats = 8
)
View Source
const LocalUri = "qemu:///system"

Variables

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

We should possibly add a filter on the type, such as [@type=\"file\"] or [@type=\"network\"]

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) (res VirDomainBlockInfo, err error)

func (*DomainImpl) BlockStats

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

func (*DomainImpl) CpuStats

func (d *DomainImpl) CpuStats() (res VirDomainCpuStats, err 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) (res VirDomainInterfaceStats, err error)

func (*DomainImpl) MemoryStats

func (d *DomainImpl) MemoryStats() (res VirDomainMemoryStat, err 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

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