metadata

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SNMP_ifDescr            = "ifDescr"
	SNMP_ifAlias            = "ifAlias"
	SNMP_ifSpeed            = "ifSpeed"
	SNMP_ipAdEntIfIndex     = "ipAdEntIfIndex"
	SNMP_ipAdEntNetMask     = "ipAdEntNetMask"
	SNMP_ipv6AddrPrefix     = "ipv6AddrPrefix"
	SNMP_ifConnectorPresent = "ConnectorPresent"
	SNMP_ifType             = "Type"
	SNMP_ifPhysAddress      = "PhysAddress"
	SNMP_ifLastChange       = "LastChange"

	SNMP_HUAWEI_ID_MAP_OID     = "1.3.6.1.4.1.2011.5.25.110.1.2.1.2"
	MIN_WORKING_HUAWEI_VERSION = 5
)
View Source
const (
	DEFAULT_INTERVAL = 30 * 60 * time.Second // Run every 30 min.

	TagValuePrefix = "$"
)

Variables

View Source
var (
	SNMP_sysDescr    = "sysDescr"
	SNMP_sysObjectID = "sysObjectID"
	SNMP_sysContact  = "sysContact"
	SNMP_sysName     = "sysName"
	SNMP_sysLocation = "sysLocation"
	SNMP_sysServices = "sysServices"
	SNMP_engineID    = "sysEngineID"

	SNMP_device_metadata_oids = func() *orderedmap.OrderedMap {
		m := orderedmap.NewOrderedMap()
		m.Set(".1.3.6.1.2.1.1.1.0", SNMP_sysDescr)
		m.Set(".1.3.6.1.2.1.1.2.0", SNMP_sysObjectID)
		m.Set(".1.3.6.1.2.1.1.4.0", SNMP_sysContact)
		m.Set(".1.3.6.1.2.1.1.5.0", SNMP_sysName)
		m.Set(".1.3.6.1.2.1.1.6.0", SNMP_sysLocation)
		m.Set(".1.3.6.1.2.1.1.7.0", SNMP_sysServices)
		m.Set(".1.3.6.1.6.3.10.2.1.1.0", SNMP_engineID)
		return m
	}()
)
View Source
var (
	SNMP_Interface_OIDS = func() *orderedmap.OrderedMap {

		m := orderedmap.NewOrderedMap()
		m.Set("1.3.6.1.2.1.31.1.1.1.15", SNMP_ifSpeed)
		m.Set("1.3.6.1.2.1.4.20.1.2", SNMP_ipAdEntIfIndex)
		m.Set("1.3.6.1.2.1.4.20.1.3", SNMP_ipAdEntNetMask)
		m.Set("1.3.6.1.2.1.55.1.8.1.2", SNMP_ipv6AddrPrefix)
		m.Set("1.3.6.1.2.1.2.2.1.6", SNMP_ifPhysAddress)
		return m
	}()
)

Functions

func GetBasicDeviceMetadata

func GetBasicDeviceMetadata(log logger.ContextL, server *gosnmp.GoSNMP) (*kt.DeviceMetricsMetadata, error)

Super basic loop to get info for discovery.

Types

type DeviceMetadata

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

func NewDeviceMetadata

func NewDeviceMetadata(deviceMetadataMibs map[string]*kt.Mib, gconf *kt.SnmpGlobalConfig, conf *kt.SnmpDeviceConfig, metrics *kt.SnmpDeviceMetric, log logger.ContextL) *DeviceMetadata

func (*DeviceMetadata) Poll

Poll device-level metadata.

type InterfaceMetadata

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

func NewInterfaceMetadata

func NewInterfaceMetadata(interfaceMetadataMibs map[string]*kt.Mib, log logger.ContextL) *InterfaceMetadata

func (*InterfaceMetadata) Poll

func (*InterfaceMetadata) UpdateForHuawei

func (im *InterfaceMetadata) UpdateForHuawei(server *gosnmp.GoSNMP, d *kt.DeviceData) error

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 (*Poller) PollSNMPMetadata

func (p *Poller) PollSNMPMetadata(ctx context.Context) (*kt.DeviceData, error)

PollSNMPMetadata checks for relatively static metadata about devices and interfaces

func (*Poller) StartLoop

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

Jump to

Keyboard shortcuts

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