snmp

package
v0.0.0-...-68d2f45 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FactProvider

type FactProvider interface {
	Facts(ctx context.Context, maxAge time.Duration) (facts map[string]string, err error)
}

type GathererWithInfo

type GathererWithInfo struct {
	Gatherer    prometheus.Gatherer
	Address     string
	ExtraLabels map[string]string
}

type Manager

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

func NewManager

func NewManager(exporterAddress string, scaperFact FactProvider, targets []config.SNMPTarget) (*Manager, prometheus.MultiError)

NewManager return a new SNMP manager.

func (*Manager) Gatherers

func (m *Manager) Gatherers() []GathererWithInfo

Gatherers return gatheres for SNMP metrics of each targets.

func (*Manager) OnlineCount

func (m *Manager) OnlineCount() int

OnlineCount return the number of target that are available (e.g. for which Facts worked). To have accurate value, Facts should be used, else the value will be updated by OnlineCount in *background* (meaning value will be available on later call to OnlineCount).

func (*Manager) Targets

func (m *Manager) Targets() []*Target

Targets return current SNMP target. The result list shouldn't be by caller mutated.

type Target

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

Target represents a snmp config instance.

func NewMock

func NewMock(opt config.SNMPTarget, mockFacts map[string]string) *Target

func (*Target) Address

func (t *Target) Address() string

func (*Target) Facts

func (t *Target) Facts(ctx context.Context, maxAge time.Duration) (facts map[string]string, err error)

func (*Target) Gather

func (t *Target) Gather() ([]*dto.MetricFamily, error)

Gather implement prometheus.Gatherer.

func (*Target) GatherWithState

func (t *Target) GatherWithState(ctx context.Context, state registry.GatherState) ([]*dto.MetricFamily, error)

func (*Target) Name

func (t *Target) Name(ctx context.Context) (string, error)

func (*Target) String

func (t *Target) String(ctx context.Context) string

type TargetOptions

type TargetOptions struct {
	Address     string
	InitialName string
}

Jump to

Keyboard shortcuts

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