Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
snmpindex_dct example usage
from Products.DataCollector.plugins.CollectorPlugin import SnmpPlugin
from Products.DataCollector.plugins.CollectorPlugin import GetTableMap
class MyPlugin(SnmpPlugin):
relname = 'myrelation'
modname = 'ZenPacks.example.MyStuff'
snmpGetTableMaps = (
GetTableMap('sometable',
'1.3.6.1.4.1.58172.100.1.1', {
'.1': 'someIndex',
'.2': 'someAlternateIndex',
'.3': 'someName',
})
)
def process(self, device, results, log):
rm = self.relMap()
for snmpindex, row in results[1].get('sometable').items():
# Any SNMP datasources with the 1.3.6.1.4.1.58172.200.1.1
# prefix will use someAlternateIndex as their snmpindex
# instead of the component's snmpindex attribute.
snmpindex_dct = {
'1.3.6.1.4.1.58172.200.1.1': row.get('someAlternateIndex'),
}
om = self.objectMap({
'id': self.prepId(row['someName']),
'title': row.get('someName'),
'snmpindex_dct': snmpindex_dct,
})
return rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.