Documentation ¶
Index ¶
- Variables
- func FetchSysObjectID(session Session) (string, error)
- type GosnmpSession
- func (s *GosnmpSession) Close() error
- func (s *GosnmpSession) Connect() error
- func (s *GosnmpSession) Get(oids []string) (result *gosnmp.SnmpPacket, err error)
- func (s *GosnmpSession) GetBulk(oids []string, bulkMaxRepetitions uint32) (result *gosnmp.SnmpPacket, err error)
- func (s *GosnmpSession) GetNext(oids []string) (result *gosnmp.SnmpPacket, err error)
- func (s *GosnmpSession) GetVersion() gosnmp.SnmpVersion
- type MockSession
- func (s *MockSession) Close() error
- func (s *MockSession) Configure(config checkconfig.CheckConfig) error
- func (s *MockSession) Connect() error
- func (s *MockSession) Get(oids []string) (result *gosnmp.SnmpPacket, err error)
- func (s *MockSession) GetBulk(oids []string, bulkMaxRepetitions uint32) (result *gosnmp.SnmpPacket, err error)
- func (s *MockSession) GetNext(oids []string) (result *gosnmp.SnmpPacket, err error)
- func (s *MockSession) GetVersion() gosnmp.SnmpVersion
- type Session
Constants ¶
This section is empty.
Variables ¶
var NewSession = NewGosnmpSession
NewSession returns a new session Can be replaced in tests to use a mock session
Functions ¶
func FetchSysObjectID ¶
FetchSysObjectID fetches the sys object id from the device
Types ¶
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 MockSession ¶
MockSession mocks a connection session
func CreateMockSession ¶
func CreateMockSession() *MockSession
CreateMockSession creates a mock session
func (*MockSession) Close ¶
func (s *MockSession) Close() error
Close is used to close the connection
func (*MockSession) Configure ¶
func (s *MockSession) Configure(config checkconfig.CheckConfig) error
Configure configures the session
func (*MockSession) Connect ¶
func (s *MockSession) Connect() error
Connect is used to create a new connection
func (*MockSession) Get ¶
func (s *MockSession) Get(oids []string) (result *gosnmp.SnmpPacket, err error)
Get will send a SNMPGET command
func (*MockSession) GetBulk ¶
func (s *MockSession) GetBulk(oids []string, bulkMaxRepetitions uint32) (result *gosnmp.SnmpPacket, err error)
GetBulk will send a SNMP BULKGET command
func (*MockSession) GetNext ¶
func (s *MockSession) GetNext(oids []string) (result *gosnmp.SnmpPacket, err error)
GetNext will send a SNMP GETNEXT command
func (*MockSession) GetVersion ¶
func (s *MockSession) 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