73 lines
1.8 KiB
Python
73 lines
1.8 KiB
Python
metadata = node.metadata['telegraf']
|
|
|
|
telegraf_config = {
|
|
'agent': {
|
|
'collection_jitter': '5s',
|
|
'debug': False,
|
|
'flush_buffer_when_full': True,
|
|
'flush_interval': '10s',
|
|
'flush_jitter': '5s',
|
|
'hostname': node.name,
|
|
'interval': '60s',
|
|
'metric_buffer_limit': 1_000_000,
|
|
'quiet': False,
|
|
'round_interval': False,
|
|
},
|
|
'inputs': {
|
|
'cpu': [{
|
|
'percpu': False,
|
|
'totalcpu': True,
|
|
'fielddrop': [
|
|
'time_*',
|
|
],
|
|
}],
|
|
'disk': [{
|
|
'ignore_fs': [
|
|
'aufs',
|
|
'devtmpfs',
|
|
'nsfs',
|
|
'tmpfs',
|
|
],
|
|
}],
|
|
'diskio': [{
|
|
'skip_serial_number': True,
|
|
}],
|
|
'kernel': [{}],
|
|
'mem': [{}],
|
|
'net': [{
|
|
'interfaces': [
|
|
'en*',
|
|
'eth*',
|
|
'wg*',
|
|
'wlp*',
|
|
],
|
|
}],
|
|
'nstat': [{}],
|
|
'processes': [{}],
|
|
'system': [{}],
|
|
**metadata.get('input_plugins', {}).get('builtin', {}),
|
|
},
|
|
'outputs': {
|
|
'influxdb_v2': [{
|
|
'urls': [metadata['influxdb_url']],
|
|
'token': metadata['influxdb_token'],
|
|
'organization': metadata['influxdb_org'],
|
|
'bucket': metadata['influxdb_bucket'],
|
|
}],
|
|
},
|
|
}
|
|
|
|
for config in metadata.get('input_plugins', {}).get('exec', {}).values():
|
|
if 'exec' not in telegraf_config['inputs']:
|
|
telegraf_config['inputs']['exec'] = []
|
|
|
|
telegraf_config['inputs']['exec'].append(config)
|
|
|
|
files = {
|
|
'/etc/telegraf/telegraf.conf': {
|
|
'content_type': 'mako',
|
|
'context': {
|
|
'config': telegraf_config,
|
|
},
|
|
},
|
|
}
|