session

package
v0.0.0-...-3264e07 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchAllOIDsUsingGetNext

func FetchAllOIDsUsingGetNext(session Session) []string

FetchAllOIDsUsingGetNext fetches all available OIDs Fetch all scalar OIDs and first row of table OIDs.

func FetchSysObjectID

func FetchSysObjectID(session Session) (string, error)

FetchSysObjectID fetches the sys object id from the device

func GetNextColumnOidNaive

func GetNextColumnOidNaive(oid string) (string, error)

GetNextColumnOidNaive will return the next column OID for a given OID This is a naive algorithm based on detecting `.1.` (the table Entry oid that contains), increase the next digit and returns it. Caveat: if the input OID index contain `.1.` the function won't return the next column OID but all the OID elements until `.1.`.

Types

type Factory

type Factory func(config *checkconfig.CheckConfig) (Session, error)

Factory will create a new Session

type GosnmpSession

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

GosnmpSession is used to connect to a snmp device

func (*GosnmpSession) Close

func (s *GosnmpSession) Close() error

Close is used to close the connection

func (*GosnmpSession) Connect

func (s *GosnmpSession) Connect() error

Connect is used to create a new connection

func (*GosnmpSession) Get

func (s *GosnmpSession) Get(oids []string) (result *gosnmp.SnmpPacket, err error)

Get will send a SNMPGET command

func (*GosnmpSession) GetBulk

func (s *GosnmpSession) GetBulk(oids []string, bulkMaxRepetitions uint32) (result *gosnmp.SnmpPacket, err error)

GetBulk will send a SNMP BULKGET command

func (*GosnmpSession) GetNext

func (s *GosnmpSession) GetNext(oids []string) (result *gosnmp.SnmpPacket, err error)

GetNext will send a SNMP GETNEXT command

func (*GosnmpSession) GetVersion

func (s *GosnmpSession) GetVersion() gosnmp.SnmpVersion

GetVersion returns the snmp version used

type Session

type Session interface {
	Connect() error
	Close() error
	Get(oids []string) (result *gosnmp.SnmpPacket, err error)
	GetBulk(oids []string, bulkMaxRepetitions uint32) (result *gosnmp.SnmpPacket, err error)
	GetNext(oids []string) (result *gosnmp.SnmpPacket, err error)
	GetVersion() gosnmp.SnmpVersion
}

Session interface for connecting to a snmp device

func NewGosnmpSession

func NewGosnmpSession(config *checkconfig.CheckConfig) (Session, error)

NewGosnmpSession creates a new session

Jump to

Keyboard shortcuts

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