snmp

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIndex added in v1.21.0

func GetIndex(mibPrefix string, node gosmi.SmiNode) (col []string, tagOids map[string]struct{})

func LoadMibsFromPath added in v1.21.0

func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) error

will give all found folders to gosmi and load in all modules found in the folders

func SnmpTranslateCall added in v1.21.0

func SnmpTranslateCall(oid string) (mibName string, oidNum string, oidText string, conversion string, node gosmi.SmiNode, err error)

Types

type ClientConfig

type ClientConfig struct {
	// Timeout to wait for a response.
	Timeout config.Duration `toml:"timeout"`
	Retries int             `toml:"retries"`
	// Values: 1, 2, 3
	Version              uint8 `toml:"version"`
	UnconnectedUDPSocket bool  `toml:"unconnected_udp_socket"`
	// Path to mib files
	Path []string `toml:"path"`
	// Translator implementation
	Translator string `toml:"-"`

	// Parameters for Version 1 & 2
	Community string `toml:"community"`

	// Parameters for Version 2 & 3
	MaxRepetitions uint32 `toml:"max_repetitions"`

	// Parameters for Version 3
	ContextName string `toml:"context_name"`
	// Values: "noAuthNoPriv", "authNoPriv", "authPriv"
	SecLevel string `toml:"sec_level"`
	SecName  string `toml:"sec_name"`
	// Values: "MD5", "SHA", "". Default: ""
	AuthProtocol string `toml:"auth_protocol"`
	AuthPassword string `toml:"auth_password"`
	// Values: "DES", "AES", "". Default: ""
	PrivProtocol string `toml:"priv_protocol"`
	PrivPassword string `toml:"priv_password"`
	EngineID     string `toml:"-"`
	EngineBoots  uint32 `toml:"-"`
	EngineTime   uint32 `toml:"-"`
}

type GosmiMibLoader added in v1.21.4

type GosmiMibLoader struct{}

type GosnmpWrapper

type GosnmpWrapper struct {
	*gosnmp.GoSNMP
}

GosnmpWrapper wraps a *gosnmp.GoSNMP object so we can use it as a snmpConnection.

func NewWrapper

func NewWrapper(s ClientConfig) (GosnmpWrapper, error)

func (GosnmpWrapper) Host

func (gs GosnmpWrapper) Host() string

Host returns the value of GoSNMP.Target.

func (GosnmpWrapper) Reconnect added in v1.23.0

func (gs GosnmpWrapper) Reconnect() error

func (*GosnmpWrapper) SetAgent

func (gs *GosnmpWrapper) SetAgent(agent string) error

SetAgent takes a url (scheme://host:port) and sets the wrapped GoSNMP struct's corresponding fields. This shouldn't be called after using the wrapped GoSNMP struct, for example after connecting.

func (GosnmpWrapper) Walk

func (gs GosnmpWrapper) Walk(oid string, fn gosnmp.WalkFunc) error

Walk wraps GoSNMP.Walk() or GoSNMP.BulkWalk(), depending on whether the connection is using SNMPv1 or newer.

type MibEntry added in v1.21.0

type MibEntry struct {
	MibName string
	OidText string
}

The following is for snmp_trap

func TrapLookup added in v1.21.0

func TrapLookup(oid string) (e MibEntry, err error)

type MibLoader added in v1.21.4

type MibLoader interface {
	// contains filtered or unexported methods
}

type TranslatorPlugin added in v1.22.0

type TranslatorPlugin interface {
	SetTranslator(name string) // Agent calls this on inputs before Init
}

Jump to

Keyboard shortcuts

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