snmp

package
v0.0.0-...-1d39891 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IfConfigOIDs = map[string]string{
	"PhysicalAddress": ".1.3.6.1.2.1.2.2.1.6",
	"State":           ".1.3.6.1.2.1.2.2.1.8",
	"MTU":             ".1.3.6.1.2.1.2.2.1.4",
	"Speed":           ".1.3.6.1.2.1.2.2.1.5",
}

IfConfigOIDs store system's port configs

View Source
var IfDescrOID = "1.3.6.1.2.1.2.2.1.2"

IfDescrOID store system's port descriptions

View Source
var IfMetricOIDs = map[string]string{
	"IfInOctets":         ".1.3.6.1.2.1.2.2.1.10",
	"IfInUcastPkts":      ".1.3.6.1.2.1.2.2.1.11",
	"IfInMulticastPkts":  ".1.3.6.1.2.1.31.1.1.1.2",
	"IfInBroadcastPkts":  ".1.3.6.1.2.1.31.1.1.1.3",
	"IfInDiscards":       ".1.3.6.1.2.1.2.2.1.13",
	"IfInErrors":         ".1.3.6.1.2.1.2.2.1.14",
	"IfInUnknownProtos":  ".1.3.6.1.2.1.2.2.1.15",
	"IfOutOctets":        ".1.3.6.1.2.1.2.2.1.16",
	"IfOutUcastPkts":     ".1.3.6.1.2.1.2.2.1.17",
	"IfOutMulticastPkts": ".1.3.6.1.2.1.31.1.1.1.4",
	"IfOutBroadcastPkts": ".1.3.6.1.2.1.31.1.1.1.5",
	"IfOutDiscards":      ".1.3.6.1.2.1.2.2.1.19",
	"IfOutErrors":        ".1.3.6.1.2.1.2.2.1.20",
}

IfMetricOIDs store system's port metrics

View Source
var IfNameOID = "1.3.6.1.2.1.31.1.1.1.1"

IfNameOID store system's port names

View Source
var LldpLocalChassisOIDs = map[string]string{
	"Description":   ".1.0.8802.1.1.2.1.3.4.0",
	"ChassisID":     ".1.0.8802.1.1.2.1.3.2.0",
	"ChassisIDType": ".1.0.8802.1.1.2.1.3.1.0",
	"SysName":       ".1.0.8802.1.1.2.1.3.3.0",
}

LldpLocalChassisOIDs store local system information

View Source
var LldpLocalPortOIDs = map[string]string{
	"Description": ".1.0.8802.1.1.2.1.3.7.1.4",
	"PortID":      ".1.0.8802.1.1.2.1.3.7.1.3",
	"PortIDType":  ".1.0.8802.1.1.2.1.3.7.1.2",
}

LldpLocalPortOIDs store local port information

View Source
var LldpRemoteChassisMgmtAddressOID = ".1.0.8802.1.1.2.1.4.2.1.4"

LldpRemoteChassisMgmtAddressOID store remote management addresses

View Source
var LldpRemotePortIDOID = ".1.0.8802.1.1.2.1.4.1.1.7"

LldpRemotePortIDOID store remote system's port ids

Functions

func NewProbe

func NewProbe(g *graph.Graph, community, interval string) (probe.Handler, error)

NewProbe initializes a new SNMP probe

Types

type Client

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

Client implements a wrapper around gosnmp.GoSNMP struct to provide additional functionalities for specific use cases in this package

func NewSnmpClient

func NewSnmpClient(target, community string) *Client

NewSnmpClient create a new SNMP client

func (*Client) Close

func (c *Client) Close()

Close closes current active connection

func (*Client) Connect

func (c *Client) Connect() error

Connect is similar to gosnmp.GoSNMP.Connect

func (*Client) Get

func (c *Client) Get(oid string) (result interface{}, err error)

Get takes an OID and return snmpget result

func (*Client) GetMany

func (c *Client) GetMany(oids map[string]string, result Metadata) (err error)

GetMany takes a map of oids and return the result of snmpget command in a map

func (*Client) GetNext

func (c *Client) GetNext(oid string) (nextOID string, result interface{}, err error)

GetNext takes an OID and return snmpgetnext result

func (*Client) GetNextMany

func (c *Client) GetNextMany(oids map[string]string, result Metadata) (nextOIDs map[string]string, err error)

GetNextMany takes a map of oids and return the result of snmpgetnext command in a map

func (*Client) Walk

func (c *Client) Walk(rootOid string, walkFn gosnmp.WalkFunc) error

Walk is similar to gosnmp.GoSNMP.Walk

type IfaceConfig

type IfaceConfig map[string]interface{}

IfaceConfig is information retrived using SNMP requests on IfConfigOIDs

func (IfaceConfig) Set

func (m IfaceConfig) Set(k string, v interface{}) error

Set value on field

type IfaceMetric

type IfaceMetric struct {
	topology.ChassisInterfaceMetric
}

IfaceMetric are information retrieved using SNMP requests on IfMetricOIDs

func (*IfaceMetric) Set

func (m *IfaceMetric) Set(k string, v interface{}) error

Set value on field

type LLDPMetadata

type LLDPMetadata lldp.Metadata

LLDPMetadata is information retrieved using SNMP requests on LLDP OIDs

func (*LLDPMetadata) Set

func (m *LLDPMetadata) Set(k string, v interface{}) error

Set value on field

type Metadata

type Metadata interface {
	Set(k string, v interface{}) error
}

Metadata represents information retrieved by using SNMP

type Probe

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

Probe implements the SNMP probe

func (*Probe) Do

func (p *Probe) Do(ctx context.Context, wg *sync.WaitGroup) error

Do implements main loop of the program

Jump to

Keyboard shortcuts

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