22 lines
615 B
Python
22 lines
615 B
Python
@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,
|
|
},
|
|
},
|
|
}
|