2021-04-23 17:27:20 +00:00
|
|
|
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,
|
|
|
|
},
|
2021-04-24 08:05:52 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:telegraf:restart',
|
|
|
|
},
|
|
|
|
},
|
2021-04-24 08:08:55 +00:00
|
|
|
'/etc/sudoers.d/telegraf': {
|
|
|
|
'source': 'sudoers',
|
|
|
|
'content_type': 'mako',
|
|
|
|
},
|
2021-04-24 08:05:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'telegraf': {
|
|
|
|
'needs': {
|
|
|
|
'file:/etc/telegraf/telegraf.conf',
|
|
|
|
'pkg_apt:telegraf',
|
|
|
|
},
|
2021-04-23 17:27:20 +00:00
|
|
|
},
|
|
|
|
}
|