poller

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestConnection

func TestConnection(p common.Poller) (err error)

TestConnection will test if we can successfully log into the provided vcenter server

Types

type ExternalPoller

type ExternalPoller struct {
	Poller
	// contains filtered or unexported fields
}

ExternalPoller extends Poller with functionality relevant to sending results to a vSummary API server over http(s).

func GetExternalPollersFromConfig

func GetExternalPollersFromConfig() (externalPollers []*ExternalPoller)

GetExternalPollersFromConfig returns preconfigured list of ExternalPoller(s) found in config

func NewExternalPoller

func NewExternalPoller(c common.Poller) (e *ExternalPoller)

NewExternalPoller returns a ExternalPoller based from a common.Poller

func (*ExternalPoller) Daemonize

func (e *ExternalPoller) Daemonize()

Daemonize is a blocking loop which continues to PollThenSend indefinitely

func (*ExternalPoller) PollThenSend

func (e *ExternalPoller) PollThenSend() (errs []error)

PollThenSend will poll all endpoints then send results to vSummary API server

func (*ExternalPoller) SendPollResults

func (e *ExternalPoller) SendPollResults(r pollResults) (err []error)

SendPollResults will attempt to send the polling results to the vSummary API server

func (*ExternalPoller) SetApiUrl

func (e *ExternalPoller) SetApiUrl(u string) (err error)

SetEndpoint sets the vSummary API server url unless it's invalid

type InternalCollector

type InternalCollector struct {
	ActivePollers []*InternalPoller
	// contains filtered or unexported fields
}

internal poller that contains a list of pollers as well as a backend db

var BuiltInCollector InternalCollector

BuiltInCollector is a package-wide instance of InternalCollector

func NewEmptyInternalCollector

func NewEmptyInternalCollector() *InternalCollector

NewEmptyInternalCollector returns an empty InternalCollector

func (*InternalCollector) GetActivePollerURLs

func (i *InternalCollector) GetActivePollerURLs() (urls []string)

GetActivePollerURLs returns a list of active pollers by URL

func (*InternalCollector) PollPollerById

func (i *InternalCollector) PollPollerById(id string) (errs []error)

PollPollerById executes a poll to a matching internal poller by id

func (*InternalCollector) RefreshPollers

func (i *InternalCollector) RefreshPollers()

RefreshPollers gets a list of pollers from backend database then populates internalPoller list of ActivePollers with it.

func (*InternalCollector) Run

func (i *InternalCollector) Run()

Run is a blocking loop. This should only be executed once. refreshing of the pollers is also handled in this function.

func (*InternalCollector) SetBackend

func (i *InternalCollector) SetBackend(backend db.Backend)

SetBackend allows InternalCollector to connect to backend database

func (*InternalCollector) StopPollersByURL

func (i *InternalCollector) StopPollersByURL(urls []string)

StopPollersByURL will stop active pollers that match the list of URLs

type InternalPoller

type InternalPoller struct {
	Poller
	// contains filtered or unexported fields
}

InternalPoller extends Poller with functionality relevant to storing results to a backend directly (not over the vSummary API server).

func NewEmptyInternalPoller

func NewEmptyInternalPoller() *InternalPoller

NewInternalPoller returns a empty InternalPoller

func NewInternalPoller

func NewInternalPoller(c common.Poller) (i *InternalPoller)

NewInternalPoller returns a InternalPoller based from a common.Poller

func (*InternalPoller) Daemonize

func (i *InternalPoller) Daemonize()

Daemonize is a blocking loop which continues to PollThenStore until the channel is closed or poller is marked as disabled.

func (*InternalPoller) PollThenStore

func (i *InternalPoller) PollThenStore() (errs []error)

PollThenStore will poll all endpoints then store results to backend db

func (*InternalPoller) SetBackend

func (i *InternalPoller) SetBackend(backend db.Backend)

SetBackend allows internalPoller to connect to backend database

func (*InternalPoller) StopPolling

func (i *InternalPoller) StopPolling()

StopPolling sends the signal to stop the loop in Deamonize

func (*InternalPoller) StorePollResults

func (i *InternalPoller) StorePollResults(r pollResults) (err []error)

StorePollResults will send results directly to backend db and not to vsummary API server

type Poller

type Poller struct {
	Name         string
	Enabled      bool
	VmwareClient *govmomi.Client
	Config       *common.Poller
}

Poller can poll a single endpoint

func NewEmptyPoller

func NewEmptyPoller() *Poller

NewEmptyPoller returns an empty Poller

func NewPoller

func NewPoller(c common.Poller) (p *Poller)

NewPoller returns a Poller based from a common.Poller

func (*Poller) Configure

func (p *Poller) Configure(c common.Poller)

Configure allows you to configure a Poller based from a common.Poller

func (*Poller) Connect

func (p *Poller) Connect(ctx *context.Context) (err error)

Connect establishes a connection to the vmware endpoint

func (*Poller) GetClusters

func (p *Poller) GetClusters() (clList []common.Cluster, err error)

func (*Poller) GetDVS

func (p *Poller) GetDVS() (list []common.VSwitch, err error)

func (*Poller) GetDVSPortgroups

func (p *Poller) GetDVSPortgroups() (list []common.Portgroup, err error)

func (*Poller) GetDatacenters

func (p *Poller) GetDatacenters() (dcList []common.Datacenter, err error)

func (*Poller) GetDatastores

func (p *Poller) GetDatastores() (list []common.Datastore, err error)

func (*Poller) GetEsxi

func (p *Poller) GetEsxi() (esxiList []common.Esxi, pNics []common.PNic, vSwitches []common.VSwitch, vSwitchPortgroups []common.Portgroup, err error)

func (*Poller) GetFolders

func (p *Poller) GetFolders() (list []common.Folder, err error)

func (*Poller) GetPollResults

func (p *Poller) GetPollResults() (r pollResults, errors []error)

GetPollResults will return pollResults along with all errors encountered during the polling

func (*Poller) GetResourcepools

func (p *Poller) GetResourcepools() (list []common.ResourcePool, err error)

func (*Poller) GetVcenter

func (p *Poller) GetVcenter() (vcenter common.VCenter, err error)

func (*Poller) GetVirtualMachines

func (p *Poller) GetVirtualMachines() (VMs []common.VirtualMachine, vDisks []common.VDisk, vNICs []common.VNic, err error)

this function returns VMs vDisks vNICs since they are all part of VirtualMachine managedObject

Jump to

Keyboard shortcuts

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