Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoName = errors.New("plugin metadata does not specify the required 'Name' field") ErrNoMaintainer = errors.New("plugin metadata does not specify the required 'Maintainer' field") )
Errors for base plugin setup/creation.
Functions ¶
func NewSnmpBasePlugin ¶
func NewSnmpBasePlugin(metadata *PluginMetadata) (*sdk.Plugin, error)
NewSnmpBasePlugin creates a new SNMP base plugin.
This base plugin can be used by other plugin implementations to inherit generic SNMP handling. Plugin implementations need only provide plugin metadata for the "subclassed" plugin and info mapping MIB devices to Synse devices.
func SnmpDeviceIdentifier ¶
SnmpDeviceIdentifier is the device identifier function used by the SDK in order to generate unique device IDs for the registered Synse devices.
This function is defined for the base SNMP plugin and is subsequently used by all plugins which use the base.
The expectation is that each device should be uniquely identifiable using a combination of the SNMP device's OID and MIB name. As such, those fields are expected in the device Data. If they are not present, the plugin will panic and terminate.
Additionally, since there may be multiple SNMP-enabled servers configured which use the same MIB, the id generation needs to take the configured host/port into account.
Generally, it is not the responsibility of the plugin writer to ensure that info exists per device because the SNMP base plugin provides utility functions which automatically fill this information in when building Synse devices.
func SnmpDeviceRegistrar ¶
SnmpDeviceRegistrar is the dynamic registration function used by the SDK to build devices at runtime.
This function is defined for the base SNMP plugin and is subsequently used by all plugins which use the base.
It loads all devices for the specified MIB and caches the SNMP configuration for each device. This allows each device to create a new client on demand using this pre-loaded configuration.