Documentation ¶
Index ¶
- Variables
- type ArgumentError
- type AuthProtocol
- type Counter32
- type Counter64
- type EndOfMibView
- type ErrorStatus
- type Gauge32
- type Integer
- type Ipaddress
- type NoSucheInstance
- type NoSucheObject
- type Null
- type OctetString
- type Oid
- func (v *Oid) AppendSubIds(subs []int) (*Oid, error)
- func (v *Oid) BigInt() (*big.Int, error)
- func (v *Oid) Compare(o *Oid) int
- func (v *Oid) Contains(o *Oid) bool
- func (v *Oid) Equal(o *Oid) bool
- func (v *Oid) Marshal() ([]byte, error)
- func (v *Oid) String() string
- func (v *Oid) Type() string
- func (v *Oid) Unmarshal(b []byte) (rest []byte, err error)
- type Oids
- type Opaque
- type Pdu
- type PduType
- type PduV1
- func (pdu *PduV1) AppendVarBind(oid *Oid, variable Variable)
- func (pdu *PduV1) ErrorIndex() int
- func (pdu *PduV1) ErrorStatus() ErrorStatus
- func (pdu *PduV1) Marshal() (b []byte, err error)
- func (pdu *PduV1) PduType() PduType
- func (pdu *PduV1) RequestId() int
- func (pdu *PduV1) SetErrorIndex(i int)
- func (pdu *PduV1) SetErrorStatus(i ErrorStatus)
- func (pdu *PduV1) SetMaxRepetitions(i int)
- func (pdu *PduV1) SetNonrepeaters(i int)
- func (pdu *PduV1) SetRequestId(i int)
- func (pdu *PduV1) String() string
- func (pdu *PduV1) Unmarshal(b []byte) (rest []byte, err error)
- func (pdu *PduV1) VarBinds() VarBinds
- type PrivProtocol
- type ResponseError
- type SNMP
- func (s *SNMP) Close()
- func (s *SNMP) GetBulkRequest(oids Oids, nonRepeaters, maxRepetitions int) (result Pdu, err error)
- func (s *SNMP) GetBulkWalk(oids Oids, nonRepeaters, maxRepetitions int) (result Pdu, err error)
- func (s *SNMP) GetNextRequest(oids Oids) (result Pdu, err error)
- func (s *SNMP) GetRequest(oids Oids) (result Pdu, err error)
- func (s *SNMP) InformRequest(varBinds VarBinds) error
- func (s *SNMP) Open() (err error)
- func (s *SNMP) String() string
- func (s *SNMP) V1Trap(varPduV1 TrapPduV1) (err error)
- func (s *SNMP) V2Trap(varBinds VarBinds) error
- type SNMPArguments
- type SNMPVersion
- type ScopedPdu
- type SecurityLevel
- type TimeTicks
- type TrapPduV1
- type VarBind
- type VarBinds
- type Variable
Constants ¶
This section is empty.
Variables ¶
var ( OidSysUpTime = MustNewOid("1.3.6.1.2.1.1.3.0") OidSnmpTrap = MustNewOid("1.3.6.1.6.3.1.1.4.1.0") OidSnmpTrapEnterprise = MustNewOid("1.3.6.1.6.3.1.1.4.3.0") )
var UnsupportedOperation error = errors.New("Unsupported operation")
Functions ¶
This section is empty.
Types ¶
type ArgumentError ¶
type ArgumentError struct { Value interface{} // Argument that has a problem Message string // Error message }
An ArgumentError suggests that the arguments are wrong
func (ArgumentError) Error ¶
func (e ArgumentError) Error() string
type AuthProtocol ¶
type AuthProtocol string
const ( Md5 AuthProtocol = "MD5" Sha AuthProtocol = "SHA" )
type EndOfMibView ¶
type EndOfMibView struct {
Null
}
func NewEndOfMibView ¶
func NewEndOfMibView() *EndOfMibView
func (*EndOfMibView) Marshal ¶
func (v *EndOfMibView) Marshal() ([]byte, error)
func (*EndOfMibView) Type ¶
func (v *EndOfMibView) Type() string
type ErrorStatus ¶
type ErrorStatus int
const ( NoError ErrorStatus = iota TooBig NoSuchName BadValue ReadOnly GenError NoAccess WrongType WrongLength WrongEncoding WrongValue NoCreation InconsistentValue CommitFailed UndoFailed AuthorizationError NotWritable InconsistentName )
func (ErrorStatus) String ¶
func (e ErrorStatus) String() string
type NoSucheInstance ¶
type NoSucheInstance struct {
Null
}
func NewNoSucheInstance ¶
func NewNoSucheInstance() *NoSucheInstance
func (*NoSucheInstance) Marshal ¶
func (v *NoSucheInstance) Marshal() ([]byte, error)
func (*NoSucheInstance) Type ¶
func (v *NoSucheInstance) Type() string
type NoSucheObject ¶
type NoSucheObject struct {
Null
}
func NewNoSucheObject ¶
func NewNoSucheObject() *NoSucheObject
func (*NoSucheObject) Marshal ¶
func (v *NoSucheObject) Marshal() ([]byte, error)
func (*NoSucheObject) Type ¶
func (v *NoSucheObject) Type() string
type OctetString ¶
type OctetString struct {
Value []byte
}
func NewOctetString ¶
func NewOctetString(b []byte) *OctetString
func (*OctetString) Marshal ¶
func (v *OctetString) Marshal() ([]byte, error)
func (*OctetString) String ¶
func (v *OctetString) String() string
func (*OctetString) Type ¶
func (v *OctetString) Type() string
type Oid ¶
type Oid struct {
Value asn1.ObjectIdentifier
}
func MustNewOid ¶
MustNewOid is like NewOid but panics if argument cannot be parsed
func (*Oid) AppendSubIds ¶
Returns Oid with additional sub-ids
func (*Oid) Compare ¶
Returns 0 this OID is equal to the specified OID, -1 this OID is lexicographically less than the specified OID, 1 this OID is lexicographically greater than the specified OID
type Opaque ¶
type Opaque struct {
OctetString
}
type Pdu ¶
type Pdu interface { PduType() PduType RequestId() int SetRequestId(int) ErrorStatus() ErrorStatus SetErrorStatus(ErrorStatus) ErrorIndex() int SetErrorIndex(int) SetNonrepeaters(int) SetMaxRepetitions(int) AppendVarBind(*Oid, Variable) VarBinds() VarBinds Marshal() ([]byte, error) Unmarshal([]byte) (rest []byte, err error) String() string }
func NewPdu ¶
func NewPdu(ver SNMPVersion, t PduType) (pdu Pdu)
func NewPduWithOids ¶
func NewPduWithOids(ver SNMPVersion, t PduType, oids Oids) (pdu Pdu)
func NewPduWithVarBinds ¶
func NewPduWithVarBinds(ver SNMPVersion, t PduType, varBinds VarBinds) (pdu Pdu)
type PduV1 ¶
type PduV1 struct {
// contains filtered or unexported fields
}
func (*PduV1) AppendVarBind ¶
func (*PduV1) ErrorIndex ¶
func (*PduV1) ErrorStatus ¶
func (pdu *PduV1) ErrorStatus() ErrorStatus
func (*PduV1) SetErrorIndex ¶
func (*PduV1) SetErrorStatus ¶
func (pdu *PduV1) SetErrorStatus(i ErrorStatus)
func (*PduV1) SetMaxRepetitions ¶
func (*PduV1) SetNonrepeaters ¶
func (*PduV1) SetRequestId ¶
type PrivProtocol ¶
type PrivProtocol string
const ( Des PrivProtocol = "DES" Aes PrivProtocol = "AES" )
type ResponseError ¶
type ResponseError struct { Cause error // Cause of the error Message string // Error message Detail string // Detail of the error for debugging }
A ResponseError suggests that the response from the remote agent is wrong or is not obtained
func (ResponseError) Error ¶
func (e ResponseError) Error() string
type SNMP ¶
type SNMP struct {
// contains filtered or unexported fields
}
SNMP Object provides functions for the SNMP Client
func (*SNMP) GetBulkRequest ¶
func (*SNMP) GetBulkWalk ¶
This method inquire about OID subtrees by repeatedly using GetBulkRequest. Returned PDU contains the varbind list of all subtrees. however, if the ErrorStatus of PDU is not the NoError, return only the last query result.
func (*SNMP) InformRequest ¶
type SNMPArguments ¶
type SNMPArguments struct { Version SNMPVersion // SNMP version to use Network string // See net.Dial parameter (The default is `udp`) Address string // See net.Dial parameter Timeout time.Duration // Request timeout (The default is 5sec) Retries uint // Number of retries (The default is `0`) MessageMaxSize int // Maximum size of an SNMP message (The default is `1400`) Community string // Community (V1 or V2c specific) UserName string // Security name (V3 specific) SecurityLevel SecurityLevel // Security level (V3 specific) AuthPassword string // Authentication protocol pass phrase (V3 specific) AuthProtocol AuthProtocol // Authentication protocol (V3 specific) PrivPassword string // Privacy protocol pass phrase (V3 specific) PrivProtocol PrivProtocol // Privacy protocol (V3 specific) SecurityEngineId string // Security engine ID (V3 specific) ContextEngineId string // Context engine ID (V3 specific) ContextName string // Context name (V3 specific) }
An argument for creating a SNMP Object
func (*SNMPArguments) String ¶
func (a *SNMPArguments) String() string
type SNMPVersion ¶
type SNMPVersion int
const ( V1 SNMPVersion = 0 V2c SNMPVersion = 1 V3 SNMPVersion = 3 )
func (SNMPVersion) String ¶
func (s SNMPVersion) String() string
type ScopedPdu ¶
The ScopedPdu is used by SNMP V3. Includes the PduV1, and contains a SNMP context parameter
type SecurityLevel ¶
type SecurityLevel int
const ( NoAuthNoPriv SecurityLevel = iota AuthNoPriv AuthPriv )
func (SecurityLevel) String ¶
func (s SecurityLevel) String() string
type VarBind ¶
func NewVarBind ¶
type VarBinds ¶
type VarBinds []*VarBind
func (VarBinds) MatchBaseOids ¶
Gets a VarBind list that matches the prefix
type Variable ¶
type Variable interface { // Return a BigInt representation of this Variable if such a representation exists BigInt() (*big.Int, error) // Return a string representation of this Variable String() string // Return a string of type Type() string Marshal() ([]byte, error) Unmarshal([]byte) (rest []byte, err error) }