bundlewrap/bundles/telegraf-monitors-mikrotik/metadata.py

23 lines
615 B
Python
Raw Permalink Normal View History

2023-04-01 05:01:03 +00:00
@metadata_reactor.provides(
'telegraf/input_plugins/exec',
)
def collect_nodes(metadata):
execs = {}
for rnode in repo.nodes_in_group('switches-mikrotik'):
snmp_pw = rnode.metadata.get('routeros/snmp/community', 'public')
execs[f'snmp_mikrotik_{rnode.name}'] = {
'commands': [f'/usr/local/bin/telegraf-plugin-snmp-mikrotik {rnode.name} {rnode.hostname} {snmp_pw}'],
'data_format': 'influx',
'timeout': '30s',
}
return {
'telegraf': {
'input_plugins': {
'exec': execs,
},
},
}