Documentation
¶
Index ¶
- func LoadMibsFromPath(paths []string, loader MibLoader) error
- func NewGosmiTranslator(paths []string) (*gosmiTranslator, error)
- func NewNetsnmpTranslator() *netsnmpTranslator
- func SnmpInlet(ctx *engine.Context) engine.Inlet
- type ClientConfig
- type Conn
- type Field
- type GosmiMibLoader
- type GosnmpWrapper
- type MibEntry
- type MibLoader
- type RTable
- type RTableRow
- type Table
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadMibsFromPath ¶
func NewGosmiTranslator ¶
func NewNetsnmpTranslator ¶
func NewNetsnmpTranslator() *netsnmpTranslator
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Timeout time.Duration
Retries int
Version int
UseUnconnectedUDPSocket bool
// Version 1 and 2
Community string
// Version 2 and 3
MaxRepetitions uint32
// Version 3 only
ContextName string
SecLevel string
SecName string
AuthProtocol string
AuthPassword string
PrivProtocol string
PrivPassword string
EngineID string
EngineBoots uint32
EngineTime uint32
}
type Field ¶
type Field struct {
Name string
Oid string
OidIndexSuffix string
OidIndexLength int
IsTag bool
// Conversion controls any type conversion that is done on the value.
// "float"/"float(0)" will convert the value into a float.
// "float(X)" will convert the value into a float, and then move the decimal before Xth right-most digit.
// "int" will convert the value into an integer.
// "hwaddr" will convert a 6-byte string to a MAC address.
// "ipaddr" will convert the value to an IPv4 or IPv6 address.
// "enum"/"enum(1)" will convert the value according to its syntax. (Only supported with gosmi translator)
Conversion string
Translate bool
SecondaryIndexTable bool
SecondaryIndexUse bool
SecondaryOuterJoin bool
// contains filtered or unexported fields
}
Fields for the configuration for a Field to look up
func (*Field) Init ¶
func (f *Field) Init(tr Translator) error
type GosmiMibLoader ¶
type GosmiMibLoader struct{}
type GosnmpWrapper ¶
func NewWrapper ¶
func NewWrapper(c ClientConfig) (GosnmpWrapper, error)
func (GosnmpWrapper) Get ¶
func (gs GosnmpWrapper) Get(oids []string) (*gosnmp.SnmpPacket, error)
func (GosnmpWrapper) Host ¶
func (gs GosnmpWrapper) Host() string
func (GosnmpWrapper) Reconnect ¶
func (gs GosnmpWrapper) Reconnect() error
func (GosnmpWrapper) SetAgent ¶
func (gs GosnmpWrapper) SetAgent(agent string) error
SetAgent sets the target agent for the connection. sheme://host:port
type RTable ¶
type RTable struct {
// Name is the name of the field, copied from Table.Name.
Name string
// Time is the time the table was built.
Time time.Time
// Rows are the rows that were found, one row for each table OID index found.
Rows []RTableRow
}
RTable is the resulting table built from a Table.
type RTableRow ¶
type RTableRow struct {
// Tags are all the Field values which had IsTag=true.
Tags map[string]string
// Fields are all the Field values which had IsTag=false.
Fields map[string]interface{}
}
RTableRow is the resulting row containing all the OID values which shared the same index.
type Table ¶
type Table struct {
Name string
InheritTags []string
IndexAsTag bool
Fields []Field
Oid string
// contains filtered or unexported fields
}
Table for the configuration of a SNMP table
type Translator ¶
type Translator interface {
SnmpTranslate(string) (
mibName string, oidNum string, oidText string,
conversion string,
err error,
)
SnmpTable(oid string) (
mibName string, oidNum string, oidText string,
fields []Field,
err error,
)
SnmpFormatEnum(oid string, value any, full bool) (
formatted string,
err error,
)
}
Click to show internal directories.
Click to hide internal directories.