metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SNMP_ifHCInOctets     = "ifHCInOctets"
	SNMP_ifHCInUcastPkts  = "ifHCInUcastPkts"
	SNMP_ifHCOutOctets    = "ifHCOutOctets"
	SNMP_ifHCOutUcastPkts = "ifHCOutUcastPkts"
	SNMP_ifInErrors       = "ifInErrors"
	SNMP_ifOutErrors      = "ifOutErrors"

	SNMP_ifInDiscards         = "ifInDiscards"
	SNMP_ifOutDiscards        = "ifOutDiscards"
	SNMP_ifHCOutMulticastPkts = "ifHCOutMulticastPkts"
	SNMP_ifHCOutBroadcastPkts = "ifHCOutBroadcastPkts"
	SNMP_ifHCInMulticastPkts  = "ifHCInMulticastPkts"
	SNMP_ifHCInBroadcastPkts  = "ifHCInBroadcastPkts"

	SNMP_ifInErrorsPercent  = "ifInErrorPercent"
	SNMP_ifOutErrorsPercent = "ifOutErrorPercent"

	AllDeviceInterface = "device"
	Uptime             = "Uptime"
)

SNMP keys used in various places

View Source
const (
	STATUS_CHECK_TIME = 60 * time.Second
)

Variables

View Source
var (
	MAX_COUNTER_INTS = 250
)

Functions

This section is empty.

Types

type DeviceMetrics

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

func NewDeviceMetrics

func NewDeviceMetrics(gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, metrics *kt.SnmpDeviceMetric, profileMetrics map[string]*kt.Mib, profile *mibs.Profile, log logger.ContextL) *DeviceMetrics

func (*DeviceMetrics) GetPingStats

func (dm *DeviceMetrics) GetPingStats(ctx context.Context, pinger *ping.Pinger) ([]*kt.JCHF, error)

func (*DeviceMetrics) GetStatusFlows

func (dm *DeviceMetrics) GetStatusFlows() []*kt.JCHF

Return a flow with status of SNMP, reguardless of if the rest of the system is working.

func (*DeviceMetrics) Poll

func (dm *DeviceMetrics) Poll(ctx context.Context, server *gosnmp.GoSNMP, pinger *ping.Pinger) ([]*kt.JCHF, error)

func (*DeviceMetrics) ResetPingStats

func (dm *DeviceMetrics) ResetPingStats()

type InterfaceMetrics

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

func NewInterfaceMetrics

func NewInterfaceMetrics(gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, metrics *kt.SnmpDeviceMetric, profileMetrics map[string]*kt.Mib, profile *mibs.Profile, tickDurationSec int, log logger.ContextL) *InterfaceMetrics

func (*InterfaceMetrics) DiscardDeltaState

func (im *InterfaceMetrics) DiscardDeltaState()

func (*InterfaceMetrics) Poll

func (im *InterfaceMetrics) Poll(ctx context.Context, server *gosnmp.GoSNMP, lastDeviceMetrics []*kt.JCHF) ([]*kt.JCHF, error)

PollSNMPCounter polls SNMP for counter statistics like # bytes and packets transferred.

type Poller

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

func NewPoller

func NewPoller(server *gosnmp.GoSNMP, gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, jchfChan chan []*kt.JCHF, metrics *kt.SnmpDeviceMetric, profile *mibs.Profile, log logger.ContextL) *Poller

func NewPollerForExtention

func NewPollerForExtention(gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, jchfChan chan []*kt.JCHF, metrics *kt.SnmpDeviceMetric, profile *mibs.Profile, log logger.ContextL) *Poller

func NewPollerForPing

func NewPollerForPing(gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, jchfChan chan []*kt.JCHF, metrics *kt.SnmpDeviceMetric, profile *mibs.Profile, log logger.ContextL) *Poller

func (*Poller) Poll

func (p *Poller) Poll(ctx context.Context) ([]*kt.JCHF, error)

PollSNMPCounter polls SNMP for counter statistics like # bytes and packets transferred.

func (*Poller) StartExtensionOnlyLoop

func (p *Poller) StartExtensionOnlyLoop(ctx context.Context)

Simpler loop which only runs on ext data, no actual snmp polling.

func (*Poller) StartLoop

func (p *Poller) StartLoop(ctx context.Context)

func (*Poller) StartPingOnlyLoop

func (p *Poller) StartPingOnlyLoop(ctx context.Context)

Simpler loop which only runs on ping data, no actual snmp polling.

Jump to

Keyboard shortcuts

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