Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrMibExists = errors.New("MIB already registered") ErrNilMib = errors.New("MIB cannot be nil") )
Errors for SNMP base plugin MIB operations.
Functions ¶
Types ¶
type MIB ¶
type MIB struct { Name string RootOid string Devices []*SnmpDevice }
MIB is a logical grouping of SnmpDevices which a SNMP plugin implementation should define. A single plugin implementation may define multiple MIBs. These MIBs are registered with the SNMP base plugin.
func Get ¶
Get a registered MIB with the given name.
If there is no MIB registered with the provided name, nil is returned.
func GetAll ¶
func GetAll() []*MIB
GetAll returns all of the MIBs which have been registered with the SNMP base plugin. The order in which the MIBs are returned is not guaranteed. If no MIBs have been registered, an empty slice is returned.
func NewMIB ¶
func NewMIB(name string, rootOid string, devices ...*SnmpDevice) *MIB
NewMIB creates a new MIB with the specified devices.
func (*MIB) LoadDevices ¶
func (mib *MIB) LoadDevices(cfg *core.SnmpTargetConfiguration, supported map[string]struct{}) ([]*sdk.Device, error)
LoadDevices loads Synse devices from the SNMP devices defined in the MIB.
type SnmpDevice ¶
type SnmpDevice struct { // Required fields OID string Info string Type string Handler string Output string // Optional fields Tags []*sdk.Tag Data map[string]interface{} Context map[string]string Alias string Transforms []sdk.Transformer WriteTimeout time.Duration }
SnmpDevice models a device and serves as the bridge between SNMP configuration and Synse device configuration.
Each SNMP plugin implementation which uses the plugin base should define these devices in the code base. A collection of SnmpDevices makes up a MIB. These devices are used to generate Synse devices on plugin init.
func (*SnmpDevice) String ¶
func (device *SnmpDevice) String() string
String returns a human-readable string, useful for identifying the device in logs.